How javascript removes the onclick event
This article mainly introduces javascript how to remove the onclick event, the article is very detailed, has a certain reference value, interested friends must read it!
Javascript removes the onclick event: 1, use the "document.getElementById (" id value ") statement to get the element object based on the id value; 2, use the" element object .onclick = null; "statement to remove the onclick event.
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
You can use the "document.getElementById (" id value ") statement to get the element object based on the id value; then use the" element object .onclick = null; "statement to remove the onclick event.
An example of the remove element onclick event is as follows:
Function myFunction () {document.getElementById ("mybutton"). Onclick=null;document.getElementById ("demo") [xss_clean] = "Hello World";}
Click the button to trigger the function.