[Solved] Why does the e.preventDefault function in javascript not work for the checkbox? [closed]
You have an spelling-error in your code: querySelecotr should be querySelector. You can also use getElementById to get an element by its id-property. Both versions work in the browsers i tested (Firefox, Chrome, Safari). If you use preventDefault(), the checked-state will be restored after the event-handler is completed. So any change inside that event-handler will … Read more