且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

试图将文本写入TinyMCE textarea中

更新时间:2023-10-06 21:36:40

为什么不简单地使用 tinymce.get('jander')。getContent(); (小包中的小蛋糕!)?

I'm trying to get the text written inside a TinyMCE textarea. I have the code below. The TinyMCE text area is showed but the alert is not even showed. Why?

<html>
    <head></head>
    <body>
        <script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.js'></script> 
        <script type="text/javascript" src="/home/javiergarcia/Scaricati/jari/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript"> 
            tinyMCE.init({
                mode : "textareas",
            });

            $(document).ready(function() {
                $('form').submit(function() {
                    //alert("fasdfs");
                    alert(tinyMCE.get('#jander').getContent());
                });
            });
        </script>
        <form method="post" action="somepage">
            <textarea name="content" id="jander" style="width:100%"></textarea> 
            <input type="submit">
        </form>
    </body>
</html>

Regards

Javier

Why don't you simply use tinymce.get('jander').getContent(); (tinymce in lowercases!) ?