If I have in the page unnecessary id
s on elements, like the HTML Helper
does in ASP.Net-MVC
.
Does it reduce the performace of my i
Selecting elements by id in jQuery is one of the few selectors that will not receive a performance hit if there are many elements on the page.
If on the other hand, you were selecting elements based on class or attribute value, you would see a significant performance hit. If you are worried about performance, also make sure to cache your jquery selectors by storing the selectors in variables for reuse.
var element = $("#specificElement");
console.log(element.val());