Answers for "function attached to button"

2

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>
Posted by: Guest on November-30-2020
2

set onclick jquery

$(elem).click(myFunc());
Posted by: Guest on May-06-2020
0

does click event work only for buttons

button > * {
  pointer-events: none;
}
Posted by: Guest on December-08-2020

Code answers related to "function attached to button"

Browse Popular Code Answers by Language