on 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 events list with examples
function fun2 (myElement){
myElement.style.backgroundColor="#ccc";
}