jQuery: change a css value if a option is selected
Posted
by
Ivan Castellanos
on Stack Overflow
See other posts from Stack Overflow
or by Ivan Castellanos
Published on 2013-10-22T02:47:45Z
Indexed on
2013/10/22
3:54 UTC
Read the original article
Hit count: 131
I'm trying to make an option dropdown menu and I got stuck when I try to show a textbox if the option 'other' is selected.
there's what I have:
<span id="con-country"><label for="country">Country: </label>
<select name="country" required="required">
<option value="usa">United States</option>
<option value="uk">United Kingdom</option>
<option id="other" value="other">Other</option>
</select>
</span>
<span id="con-specify">
<label for="specify">Specify: </label>
<input type="text" name="specify" id="c-specify" required="required"></input>
</span>
CSS:
#con-specify{
margin-left: 50px;
display: none;
}
Simple huh?, the problem is that I don't know how to do the code in jQuery
So, if the user select other in the menu, then the textbox should appear, how can I do that?
© Stack Overflow or respective owner