pure javascript equivalent of jquery click()?
问题 I am building a small app which captures mouse clicks. I wrote the prototype in jquery but, since it is a small app focusing on speed, embedding jquery to use just one function would be an overkill. I tried to adapt this example from JavascriptKit: document.getElementById("alphanumeric").onkeypress=function(e){ //blah..blah..blah.. } but it didn't work when I tried document.getElementsByTagName("x").onclick What am I doing wrong? 回答1: Say you have a list of p tags you would like to capture