internet explorer - JQuery Change CSS Display not working -
i have working on chrome , firefox when user clicks on sub image changes main image altering it's display property hide show. here's img elements.
<img id="lg1" src="http... <img id="lg2" style="display:none" src="http... <img id="lg3" style="display:none" src="http...
and js looks this:
$('#graph1').click(function() { $("#lg1").css("display","inherit"); $("#lg2").css("display","none"); $("#lg3").css("display","none"); }); $('#graph2').click(function() { $("#lg1").css("display","none"); $("#lg2").css("display","inherit"); $("#lg3").css("display","none"); }); $('#graph3').click(function() { $("#lg1").css("display","none"); $("#lg2").css("display","none"); $("#lg3").css("display","inherit"); });
in ie error:
could not display property. invalid argument.
is there anyway alter code make work chrome, ff , ie?
thanks!
"inherit" not valid display value on ie, unfortunately. try "", should work (live example) barring stylesheet rule saying otherwise element (like this).
off-topic, if want shorter way write .css("display", "none")
can use .hide()
instead. :-)
Comments
Post a Comment