Reputation: 5228
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');
}
Upvotes: 4
Views: 1811
Reputation: 6652
onclick
works in javascript, click
doesn't. If you want click
to work, you might need jQuery.
Upvotes: 8