JQuery -- this 和 $(this) 的区别
起初以为this和$(this)就是一模子刻出来。但是我在阅读时,和coding时发现,总不是一回事。
What is "this"?
In many object-oriented programming languages, this (or self) is a keyword which can be used in instance methods to refer to the object on which the currently executing method has been invoked.
$("#textbox").hover( function() { this.title = "Test"; }, fucntion() { this.title = "OK”; } );
$("#textbox").hover( function() { $(this).title = "Test"; }, function() { $(this).title = "OK"; } );
$("#textbox").hover( function() { $(this).attr(’title’, ‘Test’); }, function() { $(this).attr(’title’, ‘OK’); } );