Answers for "onclick event on non button"

0

onclick on non button

var ele = document.getElementById('x');
if(typeof ele.click == 'function') {
  ele.click()
} else if(typeof ele.onclick == 'function') {
  ele.onclick()
}
Posted by: Guest on July-30-2020

Browse Popular Code Answers by Language