Better way to call javascript function in a tag

前端 未结 4 415
时光说笑
时光说笑 2020-12-08 13:28

Which of the following ways is a better way to call a js function from an a tag?

LINK

4条回答
  •  死守一世寂寞
    2020-12-08 13:59

    Neither is good.

    Behaviour should be configured independent of the actual markup. For instance, in jQuery you might do something like

    $('#the-element').click(function () { /* perform action here */ });
    

    in a separate

提交回复
热议问题