Our volunteers haven't translated this article into বাংলা (বাংলাদেশ) yet. Join us and help get the job done!
The Element.id
property represents the element's identifier, reflecting the id global attribute.
It must be unique in a document, and is often used to retrieve the element using getElementById
. Other common usages of id
include using the element's ID as a selector when styling the document with CSS.
Note: identifiers are case-sensitive, but you should avoid creating IDs that differ only in the capitalization (see Case sensitivity in class and id names).
Syntax
var idStr = elt.id; // Get the id. elt.id = idStr; // Set the id
idStr
is the identifier of the element.
Specifications
Specification | Status | Comment |
---|---|---|
DOM The definition of 'id' in that specification. |
Living Standard | No change from Document Object Model (DOM) Level 2 HTML Specification. |
Document Object Model (DOM) Level 2 HTML Specification The definition of 'id' in that specification. |
Recommendation | No change from Document Object Model (DOM) Level 1 Specification. |
Document Object Model (DOM) Level 1 Specification The definition of 'id' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
See also
- The DOM id global attribute.
ডকুমেন্ট ট্যাগ এবং অবদানকারী
ট্যাগ:
Contributors to this page:
Jeremie,
fscholz,
teoli,
MHasan,
kscarfone,
vishu_gawli,
ScottMichaud,
Sheppy,
ethertank,
tregagnon,
ziyunfei,
Nickolay,
bigmantonyd,
Matej Lednar,
Mgjbot,
Dewang,
Ptak82,
BenoitL,
Dria,
Biesi,
Callek,
JesseW
সর্বশেষ হালনাগাদ করেছেন:
Jeremie,