HTML/JS good practices: Is it good to add too many ids?

pmcartney3

New Member
I have an HTML page where I would like to add elements to a specific list, like so:\[code\]<div id="list-of-divs"><div id="name-specific-id">// content</div><div id="another-id">//content</div>...<div id="yet-another-id"></div>\[/code\]Now I want to add new \[code\]div\[/code\]s to that list, say with the following:\[code\]<div id="new-option-panel"><input id="first-textbox-id" type="text"><input id="second-textbox-id" type=text"><button>Add new option</button>\[/code\]Of course, the addition is done with jQuery code.My question is: is it a good practice to add many such \[code\]id\[/code\]s in HTML code and depend on them in my jQuery code, or is it a bad practice for both HTML and jQuery, and I should find other ways in my jQuery code (depending on DOM traversing, for example)?Just for example of what I mean: will adding to many \[code\]id\[/code\]s slow Javascript execution?
 
Back
Top