Is there any kind of difference between the following 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');
}
onclick
works in javascript, click
doesn't. If you want click
to work, you might need jQuery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With