I'm trying to make my app run as fast as possible.
At the moment, when it runs a search, it builds the results by creating each element dynamically, like:
(outside each loop)
var theList = [];
(inside each loop):
var titleH3 = $('<h3>').append(result.title),
jobResult = $('<div>').addClass('job-result').attr({
'id': result.id,
'data-jobno': jobNo,
});
//a bunch of other info also created here (about 6 elements total)
jobResult.append(titleH3);
theList.push(jobResult);
then again outside loop:
$('#load-more').before(theList)
my question is, would it be quicker to have a div already in the html and clone it each time and change the info (title etc)?