这是问题的 JSFidle:http://jsfiddle.net/LRTh3/36/ http://jsfiddle.net/LRTh3/36/
$('div.boxes').mousedown(function (event) {
// Error on this line
var inner_box = $(".box").is(":hover");
if ( inner_box == true ) {
alert("blue,gree,pink was clicked");
}
else alert("You mousedowned on the red box");
});
console: Uncaught Error: Syntax error, unrecognized expression: hover
有效,只要one呈现“.box”层。这是一个错误吗?我该如何解决这个问题?
$('div.boxes').mousedown(function (event) {
// Error on this line
var $target = $(event.target);
if ( $target.is(".box")) {
alert("blue,gree,pink was clicked");
}
else alert("You mousedowned on the red box");
});
我把它从jQuery API 文档 http://api.jquery.com/is/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)