Document.CreateAttribute
Document.CreateAttribute method
The Document.createAttribute() method creates a new attribute node, and returns it. The object created a node implementing the Attr
interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.
public Attr CreateAttribute(String localName)
Parameter | Type | Description |
---|---|---|
localName | String | name is a String containing the name of the attribute. |
Return Value
A Attr
node.
Examples
var element = document.GetElementById("div");
var attr = document.CreateAttribute("my_attr");
attr.Value = "my_value";
element.SetAttributeNode(attr);
See Also
- class Attr
- class Document
- package com.aspose.html.Dom
- package Aspose.HTML