I have a case statement that is not working properly and I could use some eyes to see if anyone can see what I'm not!
Here is what I have:
/*this seciont shows and hides Tompkins County Responsible fields and Other County fields */ $(document).ready(function () { $('.othercounty').hide(); $('.SectionShow').hide(); $('.Submit').hide(); $('.occurrencecounty select').on ('change', function(){ var county = $(this).val(); switch (county){ case "Tompkins County": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); }} }); break; case "Bronx County": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); }} }); break; case "Kings County (Brooklyn)": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); break; case "New York County (Manhattan)": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); break; case "Queens County": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); break; case "Richmond County (Staten Island)": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); break; case "Not New York State County": $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('.SectionShow').show(); $('.Submit').show(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); break; default: $('.tompkinsresidentyn').click(function(){ if ($('input[value= "Yes"]').is(':checked')){ $('.othercounty').hide(); $('#q194').show(); $('.SectionShow').show(); $('.Submit').hide(); } else { if ($('input[value= "No"]').is(':checked')){ $('.othercounty').show(); $('.SectionShow').hide(); $('.Submit').hide(); } } }); } }); });
It never shows my .othercounty fields. :-(
It used to work. I'm not sure what I did that made it stop working.