jQuery中this和$(this)的区别

$(this)是jQuery对象,能调用jQuery方法,如.key()  .slideUp()等;

this是HTML元素对象,能调用元素属性,如this.value   this.css 等;



$('a').click(function(){ // 这里的 this 指向当前点击的DOM节点,也就是a。可以调用DOM方法,比如this.getAttribute, this.tagName ... // 这里的 $(this) 表示包装过的一个 jQuery 对象,拥有 jQuery 的一些方法,比如 $(this).addClass(), $(this).hide() ... });
原文地址:https://www.cnblogs.com/weiyuncai/p/4171502.html