开发者

JQuery Hover Attribute in IE

开发者 https://www.devze.com 2023-04-12 15:10 出处:网络
Can somebody please give a work around (preferred to be cross-browser) for the following jquery code that fails under internet explorer 8:

Can somebody please give a work around (preferred to be cross-browser) for the following jquery code that fails under internet explorer 8:

var selected = $("#SomeDivElementId :hover");

It is just a div with a nested table in html but it throws the exception:

Object does not support this property or method

The code works fine in Chrome and Firefox.

Maybe I should have b开发者_如何学Ceen more specific. The $("#SomeDivElementId :hover"); call is expected to return a jQuery object of the element in the div that was hovered on since afterwards I do something like like:

if (selected.length > 0) ...

Thanks.


Use the standard hover() function which takes two callback methods :

var selected = false
$("#SomeDivElementId").hover(function(){selected=true},function(){selected=false})
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号