jQuery click function vs inline onclick

前端 未结 5 1838
广开言路
广开言路 2021-02-08 11:28

I\'m trying to reorganize my code and make it more unobstrusive.

Mainly, there is a link for performing an action. If you click on the link, the action is performed via

5条回答
  •  甜味超标
    2021-02-08 12:11

    Since you are dynamically adding new items to the DOM, you will have to register the click handler again on the new items. jQuery sets the handler when you call $('...').click(...).

提交回复
热议问题