How to prevent checkbox from being checked in JavaScript
In this article, you are going to learn how you can prevent a checkbox from being checked using JavaScript.
Prevent checkbox from being checked
<input type="checkbox" id="my-checkbox"> <script> document.querySelector('#my-checkbox').onclick = (e)=>{ e.preventDefault(); } </script>Try it Yourself »
Use the preventDefault() method to stop the default behavior of a selected element. Learn more about preventDefault() method.
save
listen
AI Answer
How to prevent checkbox from being checked in JavaScript
0
In this article, you are going to learn how you can prevent a checkbox from being checked…
asked
Apu
0 answers
2915
In this article, you are going to learn how you can prevent a checkbox from being checked…
Answer Link
answered
Apu