KW Online Tools Zone
Knowledge Walls
View All Tools Home
HOW TO USE ONCLICK METHOD IN JAVASCRIPT WITH EXAMPLE
[Javascript editor]
Run
Share Link
Clear
HTML [Ctrl+Enter] - to run
Click Me
CSS [Ctrl+Enter] - to run
Javascript [Ctrl+Enter] - to run
document.getElementById("my_button").onclick = function(){ alert("You clicked Me!"); };
OUTPUT
Copyright © 2021 Knowledge walls, All rights reserved
Copyright © 2021 Knowledge walls, All rights reserved