Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

preventdefault javascript

document.querySelector("#id-checkbox").addEventListener("click", function(event) {
         document.getElementById("output-box").innerHTML += "Sorry! <code>preventDefault()</code> won't let you check this!<br>";
         event.preventDefault();
}, false);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #preventdefault #javascript
ADD COMMENT
Topic
Name
6+3 =