Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
127
rated 0 times [  134] [ 7]  / answers: 1 / hits: 15176  / 7 Years ago, fri, september 15, 2017, 12:00:00

I want to call a function updateText() when I click on the checkbox text_mode. I've tried using onClick=updateText() but it didn't work. I have read some comments on similar questions, but all answers are using jQuery, can I do it without using any libraries, because all the js code for this project is done without any libraries?



This is the checkbox:



<label class=checkbox-inline>
<input type=checkbox checked data-toggle=toggle data-size=mini data-onstyle=default id=text_mode onclick=updateText()>
</label>

More From » html

 Answers
33

Use the onchange event



<label class=checkbox-inline>
<input type=checkbox checked ... onchange=updateText()> Braille
</label>


That will execute it regardless of clicking the checkbox. So if you trigger the label it will also be executed.


[#56468] Wednesday, September 13, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonathoncamrynv

Total Points: 339
Total Questions: 98
Total Answers: 98

Location: Saint Vincent and the Grenadines
Member since Thu, Oct 15, 2020
4 Years ago
;