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