jeudi 27 octobre 2016

Selecting a checkbox and using button to check selected checkbox

So I have this loop and below it is a button,

Html

       

        <div class="large-3 columns">
            <button>Initiate</button>
        </div>   

and within the loop is a checkbox, so there will be 10 rows and columns of checkboxes.

Below is a script preventing the checkbox to be checked when clicked

Js

$('input[type="checkbox"]').on('click', function(event) {
event.preventDefault();
event.stopPropagation();

return false;

});

The questions are how do I make a clicked checkbox "selected" and how do I check the "selected" checkbox using a button?

Thank you in advance :)




Aucun commentaire:

Enregistrer un commentaire