Home > OS >  Does "id" become unique if the display property of the element with the same id is set to
Does "id" become unique if the display property of the element with the same id is set to

Time:12-06

Let's say you have a DIV element with id="row" in your document. And then you inserted a new DIV with the same id name and set the display property of the previous DIV to "none". Does that id of the newly created DIV become unique?

CodePudding user response:

No. Display:none is just a CSS property. Which means the element doesn't render in the view. But it exists in DOM. It exists in your syntax, and JS can work with it.

CodePudding user response:

No..It doesn't matter if they are hidden(display :"none")or not they are still in the document. Even if they are created dynamically they shouldn't have the same ID. "it's not a valid markup"

  • Related