Using the Html Agility Pack in C # I have a node I would like to add an attribute.
Currently, node is an <li> element with no attributes, and I would like to add an "active" class to it.
It seems like it is best to use node.Attributes.Add(attrClass)
Where attrClass is HtmlAttribute of class="active" .
However, if I try to define a new HtmlAttribute , I get an error indicating that it has no constructors. For example, HtmlAttribute attrClass = new HtmlAttribute();
Is there something wrong with my Html Agility Pack link, or am I doing something wrong?
Is there any other way that I could use to achieve my goal?
source share