views:

403

answers:

2

for example this code

var html = "<p>This text is <a href=#> good</a></p>";
var newNode = Builder.node('div',{className: 'test'},[html]);
$('placeholder').update(newNode);

casues the p and a tags to be shown, how do I prevent them from being escaped?

+2  A: 

The last parameter to Builder.node is "Array, List of other nodes to be appended as children" according to the Wiki. So when you pass it a string it is treated like text.

You could use:

var a = Builder.node('div').update("<a href='#'>foo</a>")

Where the link is text or:

var a = Builder.node('div', {'class':'cool'}, 
         [Builder.node('div', {'class': 'another_div'})]
        );

And you could use just Prototypes new Element() (Available as of version 1.6).

var a = new Element('div').insert(
          new Element('div', {'class': 'inner_div'}).update("Text in the inner div")
        );
Leo Lännenmäki
A: 

You can use this solution: http://sviudes.blogspot.com/2009/08/como-usar-etiquetas-html-con.html