How do I check whether a checkbox is checked in jQuery?
snippet in javascript

How do I check whether a checkbox is checked in jQuery?

user107

$("#checkkBoxId").attr("checked") ? alert("Checked") : alert("Unchecked");

How do I check whether a checkbox is checked in jQuery?

user8345

if($("#isAgeSelected").is(':checked'))
    $("#txtAge").show();  // checked
else
    $("#txtAge").hide();  // unchecked

How do I check whether a checkbox is checked in jQuery?

user8778

$get("isAgeSelected ").checked == true

How do I check whether a checkbox is checked in jQuery?

user8488

$('#isAgeSelected').bind('change', function () {

   if ($(this).is(':checked'))
     $("#txtAge").show();
   else
     $("#txtAge").hide();
});

How do I check whether a checkbox is checked in jQuery?

user4533

$('#isAgeSelected').click(function(){
   console.log(this.checked);
   if(this.checked == true) {
        $("#txtAge").show();
    } else {
       $("#txtAge").hide();
   }
});

How do I check whether a checkbox is checked in jQuery?

user1694

/* isAgeSelected being id for checkbox */

$("#isAgeSelected").click(function(){
  $(this).is(':checked') ? $("#txtAge").show() : $("#txtAge").hide();
});

How do I check whether a checkbox is checked in jQuery?

user7821

$(document).ready(function() {    
    $('#agecheckbox').click(function() {
        if($(this).is(":checked"))
        {
            $('#agetextbox').show();
        } else {
            $('#agetextbox').hide();
        }
    });
});

How do I check whether a checkbox is checked in jQuery?

user6992

if($('#isAgeSelected').prop('checked')) {
    $("#txtAge").show();
} else {
    $("#txtAge").hide();
}

How do I check whether a checkbox is checked in jQuery?

user1057

if ($('input[name="salary_in.Basic"]:checked').length > 0)

How do I check whether a checkbox is checked in jQuery?

user9232

if ( $("#checkbox:checked").length ) {       
    alert("checkbox is checked");
} else {
    alert("checkbox is not checked");
}

How do I check whether a checkbox is checked in jQuery?

user6881

<input type="button" class="check" id="checkall" value="Check All" />  &nbsp; <input type="button" id="remove" value="Delete" /> <br/>

<input type="checkbox" class="cb-element"  value="1" /> Checkbox  1 <br/>
<input type="checkbox" class="cb-element"  value="2" /> Checkbox  2 <br/>
<input type="checkbox" class="cb-element"  value="3" /> Checkbox  3 <br/>


$('#remove').attr('disabled', 'disabled'); 

$(document).ready(function() {  

    $('.cb-element').click(function() {

        if($(this).prop('checked'))
        {
            $('#remove').attr('disabled', false);
        }
        else
        {
            $('#remove').attr('disabled', true);
        }
    });   

    $('.check:button').click(function()
{
    var checked = !$(this).data('checked');
    $('input:checkbox').prop('checked', checked);
    $(this).data('checked', checked);

    if(checked == true)
    {
        $(this).val('Uncheck All');
         $('#remove').attr('disabled', false);
    }

    else if(checked == false)
    {
        $(this).val('Check All');
        $('#remove').attr('disabled', true);
    }
});
});

How do I check whether a checkbox is checked in jQuery?

user304

if ($('#isAgeSelected :checked').size() > 0)
{
    $("#txtAge").show(); 
} else { 
    $("#txtAge").hide();
}

How do I check whether a checkbox is checked in jQuery?

user8983

if (elem.checked)
if ($(elem).prop("checked"))
if ($(elem).is(":checked"))
if ($(elem).attr('checked'))

How do I check whether a checkbox is checked in jQuery?

user117

$(selector).attr('checked') !== undefined

How do I check whether a checkbox is checked in jQuery?

user2520

<script type="text/javascript">
    $(document).ready(function(){

        $("#li_13").click(function(){
            if($("#agree").attr('checked')){
                $("#saveForm").fadeIn();
            }
            else
            {
                $("#saveForm").fadeOut();
            }
        });
    });
</script>

How do I check whether a checkbox is checked in jQuery?

user7710

<input type="checkbox" id="nolunch" />
<input id="checklunch />"

    $('#nolunch').change(function () {
    if ($(this).is(':checked')) {
        $('#checklunch').val('1');
    };
    if ($(this).is(':checked') == false) {
        $('#checklunch').val('0');
    };
});

How do I check whether a checkbox is checked in jQuery?

user6834

 <input type="checkbox" id="isAgeSelected" value="1" /> <br/>
 <input type="textbox" id="txtAge" />

 $("#isAgeSelected").is(':checked') ? $("#txtAge").show() : $("#txtAge").hide();

How do I check whether a checkbox is checked in jQuery?

user6738

$('#' + id).is(":checked")

check whether a checkbox is checked in jQuery

user5704

if ($('#grepperRocks').is(':checked')) {
	// this checkbox is checked
}