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
name is a string containing the name of the attribute.
A Attr node.
var element = document.GetElementById("div"); var attr = document.CreateAttribute("my_attr"); attr.Value = "my_value"; element.SetAttributeNode(attr);