Search code examples
javascripthtmlyui2

Inserting a javascript var as markup with YUI2 insertAfter()


I'm trying to define an element in javascript as a string and then insert it. Have I defined it wrong, or is there another problem?

var NEW_ROW= '<TR class="NewRow"></TR>';
YAHOO.util.Dom.insertAfter(NEW_ROW, referenceNode);

Solution

  • It's reversed:

    YAHOO.util.Dom.insertAfter(referenceNode, NEW_ROW);