What's the difference between using jQuery's onclick and the onclick attribute?

前端 未结 3 482
温柔的废话
温柔的废话 2020-12-12 17:14

What\'s the difference between the following two pieces of HTML (apologies if there are any typos as I\'m typing this freehand)?

Using jQuery:



        
3条回答
  •  余生分开走
    2020-12-12 17:57

    It is also a cleaner separation of UI code (the HTML) and the logic code (the JavaScript). It makes reading each a bit easier.

提交回复
热议问题