jeudi 5 octobre 2017

one onclick event for multiple checkboxes using javascript

I have 45 checkboxes and the user can select only 4 not more than that,after selecting 4 checkboxes,I have to add an onclick event for those checkboxes which are checked.I am replacing that checkbox(which is checked) with a mysql query which fetch data from my database table using php

Any suggestions how i can do it for 45 checkboxes. I am attaching my code which is working for 1 checkbox.In the code below i have hardcoded data which is to be overwrite by checkbox.Thanks in advance

<div id="checkbox">
<input type="checkbox" name="lecture" value="8-9monday" id="checkbox1">Lecture<br></div>
</div>
<button type="button" onclick="document.getElementById('checkbox').innerHTML = 'HCI'">save</button></div>




Aucun commentaire:

Enregistrer un commentaire