tags:

views:

79

answers:

3

how can i get the checkbox value in jquery

+1  A: 

Like this:

$("input[type='checkbox']").val();

Or if you have set a class or id for it, you can:

$('#check_id').val();
$('.check_class').val();

Also you can check whether it is checked or not like:

if ($('#check_id').is(":checked"))
{
  // it is checked
}
Sarfraz
What does the first example do if there are multiple checkboxes on the page? Btw, it can be written in a shorter way `$("input:checkbox")`. Also, there seems to be a typo in the class selector...
Jawa
@Jawa: The first one was just an example to show the syntax and thanks for that typo.
Sarfraz
A: 

Select it then call val

David Dorward
+1  A: 

a quick search of this site is better than a quick post

look at this tread your question is too basic

mcgrailm