首页 相关文章 JQuery this 和 $(this) 的区别

JQuery this 和 $(this) 的区别

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”;
}
);

这里的this其实是一个Html 元素(textbox),textbox有text属性,所以这样写是完全没有什么问题的。
但是如果将this换成$(this)就不是那回事了,Error–报了。
Error Code:
代码如下:
$("#textbox").hover(
function() {
$...[ 查看全文 ]

2016-02-19 标签:

JQuery this 和 $(this) 的区别的相关文章

手机页面
收藏网站 回到头部