| | |
Help: Show - Hide
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Peace, Can you help me with Show And Hide?:
I made an Input text I want to hide it, And I want to show it if I click on a button. How can I do it?
Thanks.
I made an Input text I want to hide it, And I want to show it if I click on a button. How can I do it?
Thanks.
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
It can be done in two ways. The difference between the two methods is obvious: one of them(visibility) doesn't change the page layout while the other(display) does.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <script> function hide() { var elem = document.getElementById('myP'); elem.style.display = 'none'; } function show() { var elem = document.getElementById('myP'); elem.style.display = ''; } function hide2() { var elem = document.getElementById('myP2'); elem.style.visibility = 'hidden'; } function show2() { var elem = document.getElementById('myP2'); elem.style.visibility = 'visible'; } </script> </head> <body> <form> <h2 align="center">Using the display property of CSS</h2> <p id="myP">Here is some text which I want to hide</p> <br /> <input type="button" onclick="hide();" value="Hide" /> <input type="button" onclick="show();" value="Show" /> <h2 align="center">Using the visibility property of CSS</h2> <p id="myP2">Here is some text which I want to hide</p> <br /> <input type="button" onclick="hide2();" value="Hide" /> <input type="button" onclick="show2();" value="Show" /> </form> </body> </html>
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
•
•
Join Date: Dec 2008
Posts: 2
Reputation:
Solved Threads: 0
Easiest solution is to use one javascript function to show and hide.
Example :
For more details visit article
How to show and hide HTML elements using Javascript
Example :
html Syntax (Toggle Plain Text)
<a onclick ="javascript : ShowHide('HiddenDiv')" href="javascript:;" >Show/Hide</a> <div class="mid" id="HiddenDiv" style="DISPLAY: none" > This text was hidden </div> <script language="JavaScript"> function ShowHide(divId) { if(document.getElementById(divId).style.display == 'none') { document.getElementById(divId).style.display='block'; } else { document.getElementById(divId).style.display = 'none'; } } </script>
For more details visit article
How to show and hide HTML elements using Javascript
Last edited by peter_budo; Jan 18th, 2009 at 2:03 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Link from one form to another (Visual Basic 4 / 5 / 6)
- show/hide files in tools/folder options not showing (Windows NT / 2000 / XP)
- Hide and unhide web objects (VB.NET)
- Amazing Website Designs - How do they do this? (Site Layout and Usability)
- Hide all DIV's On Click (JavaScript / DHTML / AJAX)
- Hijack Help (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: content silding help!
- Next Thread: HTML to PDF document
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug calendar card checkbox child class column cookies createrange() css cursor dependent disablefirebug dom download dropdown editor element engine error events explorer ext file firehose flash form forms game google gwt html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n






