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() ... });
posted @ 2014-12-18 13:28  厚积er薄发  阅读(333)  评论(0编辑  收藏  举报