Difference between onclick and click in javascript

Is there a difference between two lines of code in javascript:

<button id='btn1' onclick='do_this();'>Button 1</button>; <button id='btn1' click='do_that();'>Button 2</button>; //some script later function do_this() { alert('this'); } function do_that() { alert('that'); } 
+4
source share
1 answer

onclick works in javascript, click no. If you want click work, you might need jQuery.

+8
source

All Articles