javascript - How to find out whether the check box is checked or not checked? -
this question has answer here:
i have below code in jsp.
<input type="checkbox" name="transport" id="bike" value="bike"> have bike <input type="checkbox" name="transport" id="car" value="car"> have car <input type="checkbox" name="transport" id="cycle" value="cycle"> have cycle
using jquery have values check box checked. how can values check box checked?
i'm not familiar jquery, try this:
var values = []; $('input[name="transport"]').each(function () { if ( $(this).is(':checked') ) { values.push( $(this).attr('value') ); } }); alert(values);
Comments
Post a Comment