I have below code in my jsp.
I have a bike
I have a car
I have a cycle
using jQuery I have to get all values whose check box is checked. How can I get the values whose check box is checked?
Answer
I'm not too familiar with jQuery, but try this:
var values = [];
$('input[name="transport"]').each(function () {
if ( $(this).is(':checked') ) {
values.push( $(this).attr('value') );
}
});
alert(values);
No comments:
Post a Comment