Can anyone explain if using the object variable selector
offers better performance compared to the traditional $("#selector")
in jQuery?
<form id="my_form" action="www.test.com" method="POST">
<input type="text" id="name">
<button type="submit" class="" style="">SEND</button>
</form>
$(document).ready(function() {
var my_form = $("#my_form"); // object variable selector
my_form.trigger("reset");
// or
$("#my_form").trigger("reset");
});
Let's just say that I will be using the $("#my_form")
more than ten times to manipulate the child elements in the DOM.
Is it better if just store the selector as an object variable for better performance or it doesn't make a difference?