删除doc准备好的jQuery

时间:2013-06-23 14:09:48

标签: jquery jquery-selectors

我有一个脚本,可以在页面准备好的文本区域添加tinymce。如何使用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
  });

});

2 个答案:

答案 0 :(得分:1)

您无法从我认为的javascript中删除代码,但您可以做的是更改转换为tinyMCE框的textarea的名称

类似的东西:

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

然后当tinyMCE命令运行时,它找不到textarea。如果您之后需要textarea服务器端,则可以将元素重命名为原来的状态。

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

答案 1 :(得分:1)

可能只是让你的对象为空

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

试试吧