The problem I have with the below is that I'm working with a form that gets passed thru several different stages and the click function triggers the 'show'.
Is there a way to have the show triggered by a similar thing to onload?
so to explain the bigger picture here. I've got a form with a radio button to 'add an image'. stage 1 of the form is for the author. stage 2 of the form is for the content editor. so the form is completed and passed to the content editor. if the radio button is checked at stage 1 the div is shown. when this form is passed to stage 2 I need the div to still be shown. hope this explains my problem further.
stage 2 is a completely different page.
Sorry this is my first time on here!
Markup
<input type = radio id = "image1" name = "image1" > image 1 </input>
<input type = radio id = "image2" name = "image2" > image 2 </input>
<div id= "div-id1" style="display:none"> image 1</div>
<div id= "div-id2" style="display:none"> image 2</div>
JavaScript
$("#image1").click(function(){
if ($("#image1").is(":checked")) {
//show the hidden div
$("#div-id1").show("slide");
}
else {
$("#div-id1").hide("slide");
}
});
$("#image2").click(function(){
if ($("#image2").is(":checked")) {
//show the hidden div
$("#div-id2").show("slide");
}
else {
$("#div-id2").hide("slide");
}
});