Vanilla JavaScript version of jQuery .click

后端 未结 7 635
孤城傲影
孤城傲影 2020-12-07 22:24

So maybe I\'m just not looking in the right places but I can\'t find a good explanation of how to do the equivalent of jQuery\'s

$(\'a\').click(function(){
          


        
相关标签:
7条回答
  • 2020-12-07 22:56
    element.addEventListener('click', function() { ... }, false);
    

    You have to locate the elements and make a loop to hook up each one.

    0 讨论(0)
提交回复
热议问题