1

我有一个脚本,可以将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
  });

});
4

2 回答 2

1

可能你只是让你的对象为空

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

试试看

于 2013-06-25T06:31:57.610 回答
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]');
于 2013-06-23T14:13:04.753 回答