Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] dynamically hide an element
- From: peter at brunone.com (Peter Brunone)
- Subject: [Javascript] dynamically hide an element
- Date: Wed Nov 29 11:05:51 2006
Hi Roland,
Instead of using style.visibility = "hidden", use style.display="none". Then, to change it back, you set the display to "inline" (it might be "block", but I'm pretty sure the default is "inline" for select elements; you can look it up if necessary).
Cheers,
Peter Brunone
______________
EasyListBox.com
From: "Dong, Roland" Roland_Dong@xxxxxxxxxx
Hello,
I need to dynamically hide and unhide a selection box based on the value selected in the first selection box. So if a user selects "a" in selection box, element id2 should be visible else it should remain hidden. I can use document.getElementByI("id2").style.visibility="visible" to make it visible and document.getElementById("ed1").style.visibility="hidden"; to make it disappear. The problem when element id2 disappears, it still keeps space there and it makes the form look bad. Is there a way to dynamically remove the space it occupies?
.......
<tr id="id1">
<td>
<select name="first" onchange="check(this)">
<option>a</option>
<option>b</option>
</select>
<td>
</tr>
<tr id ="id2" style="visibility:hidden";>
<td>
<select name="second">
<option>c</option> <option>d</option> </select>
<td>
</tr>
..............
rest of the form....
Thanks a lot,
Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.LaTech.edu/pipermail/javascript/attachments/20061129/0a5b1123/attachment-0001.html
- Follow-Ups:
- [Javascript] dynamically hide an element
- From: Aaron Bassett
- [Javascript] dynamically hide an element
- Prev by Date: [Javascript] error in "JavaScript: The Definitive Guide"?
- Next by Date: [Javascript] pb with httprequest and firefox
- Previous by thread: [Javascript] error in "JavaScript: The Definitive Guide"?
- Next by thread: [Javascript] dynamically hide an element
- Index(es):