HTML DOM Code Object


Code Object

The Code object represents an HTML <code> element.

Access a Code Object

You can access a <code> element by using getElementById():

Example

var x = document.getElementById("myCode");
Try it Yourself »

Create a Code Object

You can create a <code> element by using the document.createElement() method:

Example

var x = document.createElement("CODE");
Try it Yourself »

Standard Properties and Events

The Code object also supports the standard properties and events.


Related Pages

HTML tutorial: HTML Text Formatting Elements

HTML reference: HTML <code> tag


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.