hello,
Im not a javascript expert so Im hoping someone here can help me figure out what i need done…
I found a javascript tutorial that im trying to implement in my script.
What works: limiting the amount of check box a user can check.
not sure how to do the following: create the javascript specific to the group of check box offered to the user so that the java script doesn’t affect other checkboxs in the script.
<input id="vehicle" type="checkbox" name="vehicle[]" value="Bike">bike <br />
<input id="vehicle" type="checkbox" name="vehicle[]" value="Car">car <br />
<input id="vehicle" type="checkbox" name="vehicle[]" value="van"> Van <br />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" >
jQuery(function(){
var max = 3;
var checkboxes = $('input[type="checkbox"]');
checkboxes.change(function(){
var current = checkboxes.filter(':checked').length;
checkboxes.filter(':not(:checked)').prop('disabled', current >= max);
});
});
</script>