TinyMCE和jQuery - attr()返回一个Object

Win*_*ute 12 jquery tinymce attr

我已经通过使用data()而不是attr()解决了这个问题,但我仍然想知道这是否只是我,以及是什么导致它:

我正在使用jQuery 1.7.1和TinyMCE 3.5b3(jQuery包).没有其他JS库.

当单击链接时,此代码按预期输出"string"和锚标记的href.

$('a.page_item_delete').on('click', function(event){
    event.preventDefault();
    var $this = $(this);
    console.log(typeof $this.attr('href'));
    console.log($this.attr('href'));
});
Run Code Online (Sandbox Code Playgroud)

当我在页面上的某些textareas上激活TinyMCE时,它会输出"Object",当然,attr()会停止返回预期值.我通过以下方式激活TinyMCE:

$( 'textarea.tinymce')TinyMCE的(选择);

有没有其他人用TinyMCE经历过这种行为?是否存在已知错误或解决方法?为什么TinyMCE显然会影响页面上不相关的HTML元素?

And*_*bbs 9

我有同样的问题.它是由tinymce-jquery包引起的,它覆盖了jquery对象的attr和css方法.似乎(遗憾的是)解决方案是不使用jitery版本的tinymce.

我还没有解决为什么这不是jquery 1.6的问题,并且是1.7的问题.

编辑:

我正在使用这样的jquery插件:

$('.wysiwyg', '#EditForm').tinymce({
    -- SETTING HERE
});
Run Code Online (Sandbox Code Playgroud)

现在我已经完成了以下操作来复制使用jquery插件时所需的行为:

$('.wysiwyg', '#EditForm').each(function(){
    id = $(this).attr('id');
    var ed = new tinyMCE.Editor(id, {
    -- SETTINS HERE --          
    });
    ed.render();
});
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助