Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

javascript inline onclick get event

<div onclick="doSomething(event,this)"></div>
<script>
     function doSomething(e,el){
         e = e || window.event;
         console.log(e); //will be the event
         console.log(el); //we be the dom element 
     }
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #inline #onclick #event
ADD COMMENT
Topic
Name
2+9 =