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

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -