You can add dynamic event handlers to elements on a site to respond to visitor interactions like clicks, mouse movements, or form submissions.
To add an event handler to an element, do the following either inside or outside of the page's onReady() handler:
$w API to select the element you want to add an event handler to.onClick(), onMouseIn(), or onChange(), to define the event handler.For example, the following code adds a click event handler to a button that changes the text of a text element when clicked:
Note: You can also add event handlers using these alternative methods: