1

I have this working on chrome and firefox basically when the user clicks on a sub image it changes the main image by altering it's display property from hide to show. Here's my img elements.

<img id="lg1" src="http...
<img id="lg2" style="display:none" src="http...
<img id="lg3" style="display:none" src="http...

and my js looks like 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 I get this error:

Could not get the display property. Invalid argument.

Is there anyway I could alter my code to make it work with Chrome, FF and IE?

Thanks!

3
  • 1
    Is there any way you could change Inherit to something else? Whats it inheriting from? ie. display: block Commented Dec 1, 2010 at 18:19
  • 1
    why can't you use display: inline (or display: block)? Commented Dec 1, 2010 at 18:21
  • IE 8 preferably, but IE 7 would be nice :) Commented Dec 1, 2010 at 18:57

1 Answer 1

6

"inherit" is not a valid display value on IE, unfortunately. You could try "", it should work (live example) barring some stylesheet rule saying otherwise for that element (like this).

Off-topic, but if you want a shorter way to write .css("display", "none") you can use .hide() instead. :-)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.