setAttribute vs createAttribute()?

I am confused to use both the function. I mean which one is good to use set or createAttribute() method and when to use createAttribute?

createAttribute() creates an Attribute Node, setAttribute() creates an Attribute Node on the respective Element Node.

1 Like

So to slightly rephrase, setAttribute() is attached to an element, and createAttribute is not attached to an element allowing you to attach it later on.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.