dantepicchioni Posted February 11, 2022 Share Posted February 11, 2022 Dear Colleagues, Hi. When you say "You cannot have more than one element with the same id in an HTML document" (https://www.w3schools.com/html/html_id.asp), why do you use the word "cannot"? Should this not be "should not" because you clearly can. Sincerely, Dante Link to comment Share on other sites More sharing options...
dantepicchioni Posted February 26, 2022 Author Share Posted February 26, 2022 ☹️ Link to comment Share on other sites More sharing options...
JamesL Posted August 30, 2022 Share Posted August 30, 2022 If you have multiple IDs in a document, the browser will set the value to the last one. For example: <a id="link" href="https://google.com">Google</a> <a id="link" href="https://yahoo.com">Yahoo</a> <a id="link" href="https://ebay.com">eBay</a> In this case, the href value of the id 'link' will be 'https://ebay.com'. The other two are replaced by the last value. Can you do it? Sure. Does it help you? Not one bit. It doesn't cause your browser to self-destruct or anything. But, you can't write functional Javascript code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now