mardi 2 juin 2015

check input next of every div with class

i was trying to check all the inputs when i load the page.

My html was:

    <td class="even bundlecheckbox">
    <input onclick="bundle.changeSelection(this)" class="checkbox bundle-option-1 validate-one-required-by-name" id="bundle-option-1-2" type="checkbox" name="bundle_option[1][]" value="2"></td>

It repeats maybe 10 or maybe 4 times.

I try to make it with jQuery like this:

jQuery(document).ready(function() {
    jQuery('.bundlecheckbox').next('input').prop("checked",true);
});

But i think i was missing something.




Aucun commentaire:

Enregistrer un commentaire