Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Logispin Malta Ltd](https://secure.gravatar.com/avatar/83eab6c610cfa6e3953932687654b9bf?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Logispin Malta Ltd
2,720 Pointssorry, but i try to insert also multiple id, and like the class works anyway.
sorry, but i try to insert also multiple id, and like the class works anyway. but the teacher say that can't use the same id more times
1 Answer
![Jamie Reardon](https://uploads.teamtreehouse.com/production/profile-photos/9708342/micro_treehouse-mod-slack-profile-pic.jpg)
Jamie Reardon
Treehouse Project ReviewerWhat do you mean by inserted multiple ids? Do you just mean you have created multiple ids within the HTML document with the same name? And or, applied multiple ids with the same name and different styles?
If the answer is yes to the first one, then that means well of course it will "work" as you won't get any errors in this stage if you are just inserting the same id into an HTML document.
Your true errors will lie in the CSS and any JS code. As the main purpose of using IDs is for Javascript. Can you imagine having two or more elements with the same ID name, and have a JS file targeting that id name but you only wanted to target a specific element? Well that would go terribly wrong.
However, you can test how it won't "work" too with your HTML code. IDs are also commonly used for linking to different sections of your page.
Consider the following HTML code. The anchor element is set up to link to the header element in the document, which will take the user to the header element. Think of it as an internal link.
<header id="top">
Header Info...
</header>
<a href="#top">Back to top</a>
Now imagine having another element with the same ID name "top". You would be instructing the browser to target the wrong element that you intentionally wanted to.
Hope that helps.