lvmllc
asked on
jquery radio cahnge
I have a form question with 6 radio button options. When I select the first item the jquery change function works, but when I select the other radios nothing happens. Snippets of the form and jquery follow.
<input type="radio" name="parkVisit" id="parkVisit" value="1" />
Daily
<br />
<input type="radio" name="parkVisit" id="parkVisit" value="2" />
At least 3 times/week<br />
<input type="radio" name="parkVisit" id="parkVisit" value="3" />
Weekly<br />
<input type="radio" name="parkVisit" id="parkVisit" value="4" />
Monthly<br />
<input type="radio" name="parkVisit" id="parkVisit" value="5" />
Yearly<br />
<input type="radio" name="parkVisit" id="parkVisit" value="0" />
Never
$('#parkVisit').change(function() {
parkVisit = $("#parkVisit").val();
switch (parkVisit) {
case '1':
alert('one')
break;
case '2':
alert('two')
break;
case '3':
alert('three')
break;
case '4':
alert('four')
break;
case '5':
alert('five')
break;
case '0':
alert('zero')
break;
}
})
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER