Reply
Fri 22 Feb, 2013 08:58 am
Hello,
I am a newbie to Javascript.
Is there a way to have a div to display block/none depending on the number typed in a text field?
Example: (simplified code)
<input type="text"/>
<div class=showhide">
<p>Show or hide</p>
</div>
I need the div.showhide to display:none; if "1" is typed in the input text field, and if "2" is typed in the text field, then div.showhide needs to display:block;
1 = hide
2 = show
Something like:
If the value = 1
Then display div.showhide none
Else the value = 2
Then display div.showhide block
I have searched for code and similar ways to do this, but found no luck.
Any help is greatly appreciated!
Thank you