Which type of click handler is preferred?
Using ".click()" and ".on("click") seem to accomplish the same thing:
- $('#btnStraightforward').click(function() {
- alert('you mashed the straightforward button');
- });
-
- $( "#btnOn" ).on( "click", function() {
- alert('you mashed the on click button');
- });
...so is there any preference for one over the other? That is, if you're only responding to one event (usch as "click", above)?