Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is changing an element's ID universally supported?

I will have to toggle an ID on a <div> and was wondering if toggling element IDs will cause any errors.

Some people do not like this for stylistic reasons, but this question is not about that. I am asking whether it will cause any errors and whether it causes bad effects to do so.

like image 444
u353 Avatar asked Nov 10 '22 06:11

u353


1 Answers

Toggling the id should not cause any errors or other side effects as long as the id is not repeated on a page.

You can go ahead and do it.

You can also check out the rules of using the id attribute correctly here:

http://www.w3schools.com/tags/att_global_id.asp

This article describes the new specifications of the id atribute in HTML5:

http://mathiasbynens.be/notes/html5-id-class

like image 151
larrydalmeida Avatar answered Nov 15 '22 06:11

larrydalmeida