a element js events code example
Example 1: events in javascript
//this is an event detector for a mouseclick with Jquery
$('#id').on('click',function(){
yourFunction(args);
});
Example 2: JavaScript HTML DOM Events
<!DOCTYPE html>
<html>
<body>
<h1 onclick="this.innerHTML = 'Ooops!'">Click on this text!</h1>
</body>
</html>