Saturday 15 August 2015

How to hide & unhide with Javascript & CSS using a checkbox in Internet Explorer -


I tried it for days working in IE, and ultimately the user was presented with a warning window warning users The form that did not completely work in IE still, people are still using IE to fill out the form and I have to send an email back and forth to finish their registration, so I want to see it Am i really I can fix the underlying problem. Here is my longest registration form for an event:

I decided to handle the length of the form while revealing form elements while clicking on the user's various checkboxes, E.g. The housing section below the form is Javascript here:

  function togglehead (this field) {var item = document.getElementById (thiselem); If (item) {if (item.className == 'non-violence') {item.className = 'hidden';} and {item.className = 'unhidden'}}}}   

Here's the relevant CSS:

 . Hidden {display: none; Hidden flurry; Border: None; Text-decoration: None; Background: transparent;} Nonviolence {Performance: Block; Overflow: Auto; Border: None; Text-decoration: None; Background: Transparent;}   

And here is an example html:

  & lt; Input type = "checkbox" name = "housing" value = "yes" onclic = "javascript: togglehead ('housing quest')" /> & Lt; Div id = resident class = hide & gt; Whatever - More Farm Gum ... & lt; / Div & gt;   

How can anyone make this work in IE? I searched the overflow pile when I initially worked on it in a while ago. I tried the suggestions of a number, which was the answer to the same but slightly different problems, but none of them was working for me (I would like to tell you that I have tried, but I can not remember now Can).

Thanks, Rob

UPDATE: I have confirmed to myself that the code is IE 9 & amp; 10 (Regardless of what other testers were saying to me), then this question is specifically for IE 8 and below. Obviously, some of my users are still using older versions of IE In fact, a favorite printing for one screen shots was sent to me to register a registration instead of setting up another up-to-date browser! Sigh

Enter an ID for the first input: < Pre> & lt; Input id = "test" type = "checkbox" name = "housing" value = "yes" /> & Lt; Div id = "housecall" class = "hidden" & gt; Whatever - More Farm Gum ... & lt; / Div & gt;

Then use this jquery code:

  $ ("input # test"). Click (function () (if ($ (this). (":" Checked ")) {$ (" div # home-form "). Show ();} and {$ (" div # ) Hide ();}});    

No comments:

Post a Comment