Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add onclick event in javascript

var element = document.getElementById("elem");
element.onclick = function(event) {
  console.log(event);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular int to string 
Javascript :: fakepath js 
Javascript :: downgrade react version to 17 
Javascript :: jquery all elements whose id contains 
Javascript :: mongoDb Importar json para DataBase 
Javascript :: redirect angular 
Javascript :: nods js fs append to file 
Javascript :: classlist has class 
Javascript :: slick on init 
Javascript :: js append query string to url 
Javascript :: toggle multiple classes jquery 
Javascript :: js arrotondare numeri 
Javascript :: v-select on change 
Javascript :: pass array of strings to match in str.replace 
Javascript :: js remove spaces 
Javascript :: Math prime js 
Javascript :: jquery is triggered on every element with class name 
Javascript :: javascript replace string 
Javascript :: matrix elements sum javascript 
Javascript :: v-switch vuex store 
Javascript :: electron download 
Javascript :: how to encode a string in javascript 
Javascript :: how to use regex in jquery 
Javascript :: kill node process 
Javascript :: .style.display 
Javascript :: js append class 
Javascript :: fetch data from api in react 
Javascript :: How to clear localStorage when browser/tab is closing 
Javascript :: react native flatlist from bottom to top 
Javascript :: concurrently script 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =