document.getElementById("-1").click()
<div tabindex="-1" id="-1" onclick="console.log('yes1')"></div>
Somehow document.getElementById("-1").click()
throws the error Cannot read property 'click' of null.
Please help.
document.getElementById("-1").click()
<div tabindex="-1" id="-1" onclick="console.log('yes1')"></div>
Somehow document.getElementById("-1").click()
throws the error Cannot read property 'click' of null.
Please help.
Your code works. Try to see where do you use click()
function and see if they throw an error or not.
document.getElementById("-1").click();
<div tabindex="-1" id="-1" onclick="console.log('yes1')"></div>