Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the DOM are node ids case sensititve?

Tags:

Is this HTML valid? Or is the id 'a' the same as the id 'A'?

<div id="a">alpha</div> <div id="A">Alpha</div> 
like image 895
Josh Gibson Avatar asked Aug 06 '09 03:08

Josh Gibson


People also ask

Are Div IDS case-sensitive?

Note: The id name is case sensitive! Note: The id name must contain at least one character, cannot start with a number, and must not contain whitespaces (spaces, tabs, etc.).

Are IDS case-sensitive JavaScript?

JavaScript is a case-sensitive language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

Whats is id in Dom?

The DOM id Property is used to set or return the id of an element i.e value of the Id Attribute. An ID should be different in a document. It is returned by using the document.


1 Answers

Yes. It is case-sensitive. Attribute values are always case-sensitive. Different browsers seem to be doing different things though.

Handling document.getElementById is different across browsers:

  1. Mozilla performs case-sensitive search.

  2. Internet Explorer: IE 8 and later performs case-sensitive search, while IE 7 and earlier performs case-insensitive search.

like image 169
notnoop Avatar answered Nov 05 '22 04:11

notnoop