1
I am using an Event Listener to catch the click on an element with jQuery:
$('#elemento').on('click', function () {
...
});
My question is whether I should put this "Event Listener" inside the "Document ready" function of the form below or not need?
$(document).ready(function(){
$('#elemento').on('click', function () {
...
});
});
Can I leave it out as in the first block? What is the best way to do it?
Moreover jquery mutes errors that would be logged in if you were doing the same thing (linking event to non-existent element) in pure js.
– bfavaretto