troubleshooting Question

jquery radio cahnge

Avatar of lvmllc
lvmllcFlag for United States of America asked on
JavaScript
3 Comments2 Solutions390 ViewsLast Modified:
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;
		}
		
	})
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros