use on click in button code example Example: button on click script <button onclick="myFunction()">Click me</button>