Quick question about jQuery selector content efficiency
- by serg
I am loading HTML page through ajax and then doing a bunch of searches using selectors:
$.ajax({
...
dataType: "html",
success: function(html) {
$("#id1", html);
$(".class", html);
//...
}
}
Should I extract $(html) into a variable and use it as a content, or it doesn't matter (from performance point)?
success: function(html) {
$html = $(html);
$("#id1", $html);
$(".class", $html);
//...
}