0)?true:false)%> ...">

How do I get the status of a checkbox?

I have the following html control:

  <%= Html.CheckBox("MyStatus", (item.MyStatus>0)?true:false)%>

      

Then I want to get the value for this checkbox: if checked, return true, otherwise return false. I am trying this as shown below:

$("#MyStatus").attr("checked").value

      

but I cannot get the correct value.

How to solve it?

+2


source to share


2 answers


$("#MyStatus").is(":checked");

      



+4


source


How to check if a checkbox is checked using jQuery http://jquery-howto.blogspot.com/2008/12/how-to-check-if-checkbox-is-checked.html



0


source







All Articles