Shardul Upadhyay
Shardul Upadhyay

Reputation: 417

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 been 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.

Upvotes: 0

Views: 219

Answers (1)

solendil
solendil

Reputation: 8468

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

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

Upvotes: 1

Related Questions