jquery validation和tinymce非空验证问题

jquery validation对tinymce的内容都要点击两次才能提交,第一次点击即使用内容还是提示为空。于是用firebug看了下,是因为textaera里的内容是点击以后才付值进去,网上找了下解决办法如下:

tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "fullscreen",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,fullscreen",
        theme_advanced_buttons2 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        elements : "content",
        init_instance_callback : "initialiseInstance"
    });
    function initialiseInstance(editor)
    {
        //Get the textarea
        var container = $('#' + editor.editorId);
 
        //Get the form submit buttons for the textarea
        $(editor.formElement).find("input[type=submit]").click(
        function(event)
        {
            container.val(editor.getContent());
        });
    }

发表评论

电子邮件地址不会被公开。 必填项已用*标注