lundi 12 juillet 2021

How to create a checkbox with a clickable label that trigger seperate event and not checkout/in the checkbox

there is this [question][1] about the clickable label,
what im trying to find out how to make clickable labels that are not check-in/out the
Checkbox. but trigger separate event which effecting the checkbox

this is the div with the checkboxs and lables

  <div class="containerSelectBox" id="multi_select">
                <input type="checkbox" /><label id="a1"> This is checkbox </label><br/>
                <input type="checkbox" /><label id="a2"> This is checkbox </label><br/>
                <input type="checkbox" /><label id="a3"> This is checkbox </label><br/>
                <input type="checkbox" /><label  id="a4"> This is checkbox </label><br/>
                <input type="checkbox" /><label  id="a5"> This is checkbox </label><br/>

            </div>

what I like to find is when clicking on each lable it will for example alert the id of this label.
i cant just write onclick on each label i need to attach dynamically the onclick event trigger
[1]: How to create a checkbox with a clickable label?




Aucun commentaire:

Enregistrer un commentaire