jeudi 31 mars 2016

Execute function when one of many checkboxes are checked

I have some check boxes in a table as shown below:

    <table id="checkBoxTable" class="uk-margin-small-top uk-hidden checkBoxTable" style="width:100%">
        <tr>
            <td><label id="1"><input name="1" type="checkbox"> 12am-1am</label</td>
            <td><label id="2"><input name="2" type="checkbox"> 1am-2am</label</td>
            <td><label id="3"><input name="3" type="checkbox"> 2am-3am</label></td>
            <td><label id="4"><input name="4" type="checkbox"> 3am-4am</labe</td>
       </tr>
    </table>

I want to execute a function whenever any of the checkboxes are checked. I've been trying the following:

$('#checkBoxTable').change(function(){
        var price = 10 * originalPrice;
        $('#price').value = price + "";

    });




Aucun commentaire:

Enregistrer un commentaire