$(document).ready(
function()
{
$('input[id^="btnRemoveCategory"]').bind(
'click',
function(){
if($('input[id^="chkIsBottom_":checked]'))
alert('YES YES YES!!!!');
else
alert('No NO no!!!!!');
I’ve tried with the:
if($('input[id^="chkIsBottom_"]').attr(checked))
also….
where is my mistake???
10x
… is always going to return a true value. If none are checked, then it will be a jQuery object with no element inside it. You want:
(which will be false if the length is 0, and true if it isn’t)
Meanwhile:
… will get the value of the X attribute of the first input element with an id that starts with chkIsBottom_, where X is whatever the variable checked contains (which is probably undefined, since you probably intended to pass a string).