未捕获错误:语法错误,无法识别的表达式:悬停 [英] Uncaught Error: Syntax error, unrecognized expression: hover
本文介绍了未捕获错误:语法错误,无法识别的表达式:悬停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是该问题的JSFidle: http://jsfiddle.net/LRTh3/36/
Here is the JSFidle to the problem: 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
如果只显示一个.box图层,则有效。这是一个错误吗?我该如何解决这个问题?
Works if only one ".box" layer is presented. Is this a bug? How would I fix this?
推荐答案
$('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");
});
这篇关于未捕获错误:语法错误,无法识别的表达式:悬停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文