-2

hi i don't have much knowledge of the jquery

i have some problem with the Checkbox attribute.

here below i mentioned some code

code : $( this ).html()

output :

<input name="cb_kot[]" class="cb_kot cb_1" id="cb_1" checked="checked" type="checkbox"><label class="quan_count" style="text-align: left;width: 20px; margin: 1px 0 0 0; padding: 0px 20px 0 18px;">1</label><label style="margin-left:18px;width: 170px;">Fish Shorma</label> <label class="bill_price" style=" float: right;margin-right: 20px;">Rs 195</label><a class="icon-x-alt kot_delete" title="Delete" href="javascript:void(0)"></a>

in the code i am getting the above html. now you can see in above that there is a checkbox in html. now i want to check that this checkbox is checked or not so can anyone advice me how can i find it ?

thanks in advance

Thanks

deck john
  • 637
  • 1
  • 9
  • 22

4 Answers4

1

like $("#cb_1:checked") in jquery

Refer this link for more details :checked

Arunkumar
  • 5,150
  • 4
  • 28
  • 40
1

You can use like this:

$('#cb_1').is(":checked")

This code returns true if checked else returns false.

see more about this here

Community
  • 1
  • 1
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
0

try this:

 var isChecked=$("#cb_1").is(":checked");
Super Hornet
  • 2,839
  • 5
  • 27
  • 55
0

Try this : find checkbox with id="cb_1" and check if it is checked or not using is(':checked')

  var checkedStatus =  $(code).find('#cb_1').is(':checked');
  alert(checkedStatus);
Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57