JQuery Hover Attribute in IE
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})
精彩评论