DocumentCreateAttribute 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.

Namespace: Aspose.Html.Dom
Assembly: Aspose.HTML (in Aspose.HTML.dll) Version: 22.4
Syntax
public Attr CreateAttribute(
	string localName
)

Parameters

localName
Type: SystemString

name is a string containing the name of the attribute.

Return Value

Type: Attr

A Attr node.

Examples
var element = document.GetElementById("div");
var attr = document.CreateAttribute("my_attr");
attr.Value = "my_value";
element.SetAttributeNode(attr);
See Also