The onclick attribute in HTML is used to specify a JavaScript function or code that should be executed when an element, typically a button, is clicked. It allows you to create interactive web pages by responding to user actions.
Here’s an example:
<button onclick="alert('Hello, World!')">Click Here</button>
In this example, when the button is clicked, an alert box will display the message "Hello, World!".
