John John - 4 years ago 132
Javascript Question

check if a checkbox inside a label is ticked or not

I have a checkbox inside a label

<label class="selectit"><input value="84" name="download_category[]" id="in-download_category-84" type="checkbox"> CPU, HDD, Ram</label>

I want to check if the checkbox is check or not without using checkbox id.

<script src=""></script>

//Go and check if checkbox is check.
//If checkbox is tick

How can I do it?

Answer Source

Please try this

$(".selectit").click(function() {
  if ($(this).find('input[type=checkbox]').is(":checked")) {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download