关于js选择器 get()的问题

问题案例:

$(this).children().get(0).hide(); 不能隐藏

var c =$(this).children().get(0);

$(c).hide(); 就可以

问题解析:

因为你通过$(this).children().get(0)获得的是一个DOM对象,无法调用hide()方法。
第二行代码中$(c)将DOM对象c转换成了jQuery对象,所以调用hide()成功。
 
 
说明:get(0)并不是jQuery的选择器

猜你喜欢

转载自blog.csdn.net/qq15577969/article/details/80285369
今日推荐