$("button").click(function () {
$("div").each(function (index, domEle) {
// domEle == this
$(domEle).css("backgroundColor", "yellow");
if ($(this).is("#stop")) {
$("span").text("Stopped at div index #" + index);
return false;
}
});
});
其中 if ($(this).is("#stop")) 这句代码是什么意思啊,$(this)是指的 div 所转化成的 jqurey 对象吗
如果当前激发此事件的空间ID为“stop”那么。。
下面应该是对的了
Jquery:
if ($(this).is("#stop"))JS:
if(this.stop())
用一个表达式来检查当前选择的元素集合,如果其中至少有一个元素符合这个给定的表达式就返回true。
if ($(this).is("#stop"))
当前的元素是不是id为stop的元素
THIS 指的是当前each 的 div ,
if ($(this).is("#stop")) 表示当前的div的id 否是 stop