【浅谈jQuery构造函数分析_jquery】教程文章相关的互联网学习教程文章

javascript – jQuery双对象构造函数 – 例如$($(本))【代码】

假设您有以下代码:function name() {$(this).css('background', 'red'); }$('selector1').click(name);$('selector2').click(function () {name.call($(this).parent()); });现在,当通过单击’selector1’调用该函数时,这是一个HTML对象和$(this)一个jQuery对象,但是如果通过单击’selector2’来调用该函数,那么这已经是一个jQuery对象了,所以$(这个)? 我知道我可以做一些像name.call($(this).parent()[0]);得到一个HTML对象,但我...

构造函数 - 相关标签