-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
  • 597
  • 1
  • 8
  • 22

4 Answers4

1

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

Refer this link for more details :checked

Arunkumar
  • 4,750
  • 4
  • 25
  • 39
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
  • 78,842
  • 31
  • 152
  • 211
0

try this:

 var isChecked=$("#cb_1").is(":checked");
Super Hornet
  • 2,709
  • 5
  • 25
  • 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
  • 27,908
  • 5
  • 34
  • 57