jquery中this与$(this)区别

来源:互联网 发布:网络验证对比 编辑:程序博客网 时间:2024/06/05 14:13

jqeury中this是js返回的html对象,而$(this)返回的是封装过后的jquery对象。

比较:

  1. $("#textbox").hover(   
  2.       function() {   
  3.            this.title = "Test";   
  4.       },   
  5.       fucntion() {   
  6.           this.title = "OK”;   
  7.       }   
  8. ); 
  1. $("#textbox").hover(   
  2.       function() {   
  3.          $(this).attr(’title’, ‘Test’);   
  4.       },   
  5.       function() {   
  6.          $(this).attr(’title’, ‘OK’);   
  7.       }   
  8. ); 

0 0