I am using Jquery to change the value of a hidden input to True
when the user checks a checkbox in a different form field. It looks like this:
$(function(){
$('.year').click(function(){
$('#carsearch').val('True');
});
It works great except if the user changes their mind and unchecks the box, the hidden input keeps the value of True
. I want to make it so that if they change their mind and uncheck the .year
input that it changes the value of #carsearch
back to False
.
I would really appreciate any input on how this is accomplished.