Prototype - click event by element class name

前端 未结 2 1708
傲寒
傲寒 2021-02-13 18:41

I am new to the prototype framework and am trying something really simple and failing. I am trying to respond to a click event on a button like so:

$$(\'.btn\')         


        
2条回答
  •  不思量自难忘°
    2021-02-13 18:50

    Can be also be done with a single-liner, as someone already suggested in a comment:

    $$('.btn').invoke('observe', 'click', respond);
    

提交回复
热议问题