I have this code
$('#Submit').click(function(event) {
var checked = $('.inputchbox'); ......IE8
var ids= checked.map(function() {
return $(this).val();
}).get().join(',');
alert(ids);
});
This Code return all the values which is there for Checkboxbox (.inputchbox is class for the checkbox)
but If I give somethign like this
var checked = $('.inputchbox input:checkbox:checked');
or
var checked = $('.inputchbox input[type=checkbox]:checked');
or
var checked = $('.inputchbox input[name=chk]:checked');
or
var checked = $('.inputchbox').find('input[type=checkbox]:checked');
if i am giving like this nothing is working for me I am not getting the result in IE8?
var checked = $('.inputchbox'); .....this is working but I am getting the checkboxes ids its doesnot checking wheather its checked or not..
I need to get only checked chekcbox id’s
thanks
How about
?
The problem with your snippets is that the space you’re using is the descendant selector and will look down into the DOM. The
.find()method does the same. g.d.d.c was correct in replying that.filter()instead of.find()should work equally well (but a marginal amount slower):