Skip to content Skip to sidebar Skip to footer

How To Index Div Tag With Same Id On Html5

Let say, I have code as follow
Content Baloon
Content Big
And I want to get inne

Solution 1:

You can't have elements with the same ID in an HTML (5 or any other version) document - it is an error. Therefore, there is no way javascript can address this.

Check the HTML spect at http://www.w3.org/TR/html401/struct/global.html#h-7.5.2

You can have multiple elements with the same "name" property - and javascript offers support for that.

Solution 2:

Just make tes a class and use Javascript to fetch all div elements with the class.

Then iterate through that set of elements and check for the specific data-name attribute you want to match.

Solution 3:

Every div tag "class" or "id" cannot have same specific name.

data-name is use to match javascript function nor command given.

Post a Comment for "How To Index Div Tag With Same Id On Html5"