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
- namespace Aspose.Html.Dom
- assembly Aspose.HTML