2013-06-23 91 views
1

我有一個腳本,將tinymce添加到頁面準備好的textarea。如何使用jquery刪除這段代碼,所以這段代碼不會對頁面做任何更改? (我不能從核心文件修改此),我需要刪除,看起來像這樣的代碼:刪除jQuery添加文檔就緒

$(document).ready(function() { 

    jQuery('#join_form [name="DescriptionMe[0]"]').tinymce({ 

     plugins: 'autolink,autosave,lists,inlinepopups,paste,fullscreen', 
     width: '100%', 
     height: '150', 
     theme: 'advanced', 
     theme_advanced_buttons1: 'bold,italic,underline,removeformat,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,|,blockquote,|,link,unlink,image', 
     theme_advanced_buttons2: '', 
     theme_advanced_buttons3: '', 
     theme_advanced_toolbar_location: 'top', 
     theme_advanced_toolbar_align: 'left', 
     theme_advanced_statusbar_location: 'none', 

     document_base_url: 'http://website.com/demo/d7s/', 
     remove_script_host: false, 
     relative_urls: false, 
     script_url: 'http://website.com/demo/d7s/plugins/tiny_mce/tiny_mce_gzip.php', 
     skin: 'default', 
     language: 'en', 
     content_css: 'http://website.com/demo/d7s/templates/base/css/editor.css', 
     gecko_spellcheck: true, 
     entity_encoding: 'raw', 
     verify_html: false 
    }); 

}); 

$(document).ready(function() { 

     jQuery('#join_form [name="DescriptionMe[1]"]').tinymce({ 

       plugins: 'autolink,autosave,lists,inlinepopups,paste,fullscreen', 
         width: '100%', 
         height: '150', 
         theme: 'advanced', 
         theme_advanced_buttons1: 'bold,italic,underline,removeformat,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,|,blockquote,|,link,unlink,image', 
         theme_advanced_buttons2: '', 
         theme_advanced_buttons3: '', 
         theme_advanced_toolbar_location: 'top', 
         theme_advanced_toolbar_align: 'left', 
         theme_advanced_statusbar_location: 'none', 

         document_base_url: 'http://website.com/demo/d7s/', 
         remove_script_host: false, 
         relative_urls: false, 
         script_url: ' 
    http: //website.com/demo/d7s/plugins/tiny_mce/tiny_mce_gzip.php', 
    skin: 'default', 
    language: 'en', 
    content_css: 'http://website.com/d7s/templates/base/css/editor.css', 
    gecko_spellcheck: true, 
    entity_encoding: 'raw', 
    verify_html: false 
    }); 

}); 

回答

1

無法刪除從JavaScript我認爲的代碼,但你可以做的是改變textarea的名稱被轉換爲TinyMCE的框

喜歡的東西:

jQuery('#join_form [name="DescriptionMe[0]"]').attr('name', 'somethingelse'); 

然後TinyMCE的命令運行時,它無法找到textarea的。如果之後需要textarea服務器端,您可以將該元素重命名爲原來的內容。

jQuery('#join_form [name="somethingelse"]').attr('name', 'DescriptionMe[0]'); 
1

可能你只是讓你的對象空像

jQuery('#join_form [name="DescriptionMe[0]"]').tinymce=null; 

只是嘗試一下