JQuery: show div on radiobutton select
Posted
by nav
on Stack Overflow
See other posts from Stack Overflow
or by nav
Published on 2010-04-14T12:58:48Z
Indexed on
2010/04/14
13:03 UTC
Read the original article
Hit count: 282
Hi,
I am trying to use JQuery to show a div when the user selects a particular radio button (Other) within a radiobutton group.
The html is below
<div id="countries">
<input id="Washington_D.C" TYPE="RADIO" NAME="location" VALUE="Washington">Washington D.C</input>
<input id="Other" TYPE="RADIO" NAME="location" VALUE="">Other</input>
<div id="other locations" style="display: none">
</div>
</div>
Using the JQuery code:
$(document).ready(function(){
$("radio[@name='location']").change(function(){
if ($("radio[@name='location']:checked").val() == 'Other')
$("#county_drop_down").show();
});
});
But its not showing the div 'other locations' when I select the radiobutton'Other'....
© Stack Overflow or respective owner