Document getElementById() Method
Document Object
Definition and Usage
The getElementById() method accesses the first element with the specified id.
Syntax
| document.getElementById("id") |
| Parameter |
Description |
| id |
Required. The id of the element you want to access/manipulate |
Browser Support

The getElementById() method is supported in all major browsers.
Example
Example
Alert innerHTML of an element with a specific ID:
<html>
<head>
<script type="text/javascript">
function getValue()
{
var x=document.getElementById("myHeader");
alert(x.innerHTML);
}
</script>
</head>
<body>
<h1 id="myHeader" onclick="getValue()">Click me!</h1>
</body>
</html>
|
Try it yourself »
|
Document Object
Stylus Studio® 2010 XML Enterprise Suite raises the bar for productivity in XML development tools.
Millions of XML developers and data integration specialists turn to Stylus Studio's comprehensive and intuitive
XML toolset to tackle today's advanced XML data transformation and aggregation challenges.
|
- XML Pipeline Editor, Debugger and Code Generator
- DataDirect XML Converters
- XQuery Mapper, Editor, Debugger, and Profiler
- XSLT Mapper, Editor, Debugger, Designer, and Profiler
- Java and C# for .Net Code Generation
- XML Schema Designer With Documentation Generator
- XML Editor With Full XPath Integration
Download a free trial now
|
|