Jump to content

HTML id attribute


dantepicchioni

Recommended Posts

  • 3 weeks later...
  • 6 months later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...