DOM Document createCDATASection() Method
The following code fragment uses the xml file: "books.xml".
Example
Create a CDATASection and add it to an element:
xmlDoc.createCDATASection("Read all about it");
Try it Yourself »
Description
The createCDATASection() method creates a CDATASection node with the specified text.
Note: createCDATASection is intended for XML and will not work for HTML documents.
Browser Support
| Method | |||||
|---|---|---|---|---|---|
| createCDATASection() | Yes | Yes | Yes | Yes | Yes |
Note: This method is made for the XML DOM, and will not work for HTML documents.
Syntax
document.createCDATASection(text)
Parameters
| Parameter | Type | Description |
|---|---|---|
| text | String | Optional. The text you want to put into the CDATASection |
Return Value
| Type | Description |
|---|---|
| CDATASection object | The created CDATASection node |
Technical Details
| DOM Version | Core Level 1 |
|---|