I always use jquery event like:
$(element).on('click', function() {
DoSomething();
});
But other way is exists - add "onclick" attribute to html element:
<button onclick="DoSomething()"></button>
Which way is better and why?
I always use jquery event like:
$(element).on('click', function() {
DoSomething();
});
But other way is exists - add "onclick" attribute to html element:
<button onclick="DoSomething()"></button>
Which way is better and why?