Question 1 of 82
What is the difference between these two snippets?
$('button').on('click', function () { alert('you clicked the button!'); }); $('button').click(function () { alert('you clicked the button!'); });
Only the second one will work; jQuery does not have a function called .on.
.on
The second snippet will not function.
Nothing .click(function) is shorter way to write .on('click', function).
.click(function)
.on('click', function)
The first snippet will execute for every button on the page, the second will only apply to the first button.
Time Remaining:01:30
Questions: 1/82