4 Replies Latest reply on Jul 31, 2012 8:45 AM by lanejd

    JS -- XML Question - Can I add attributes using Javascript?


      I want to add an attribute to an element tag, but I don't see how to do it programmatically. Is it possible? Also, is there a way to name an element tag dynamically? For example:


      The way to add a child element is to either use the appendChild method like this:


      XMLObject.childElement= "something";


      or just add it like this:


      XMLObject.childElement = "something";


      Right? (Side Question: Is there a difference between these two methods?).


      What I want to do is to either add a dynamic attribute to a statically named child, or to create a dynamically named child.


      I haven't been able to figure this out myself. Any ideas?