When using $ ("# id"), jquery will still need to scroll through the elements to find the correct one, so adding to the DOM will make it slower, but it will only be slow when the DOM is massive.
It depends on how much you want to add to the DOM. A few hundred lines will not matter much in new browsers, problems with IE8 and lower may occur.
I suggest making a test in the oldest browser that you are going to support, if it works fine, then it should be fine on others.
source
share