On Dec 6, 2010, at 11:48 AM, Luke wrote:
Hi, I'm loading some plain HTML via Ajax.Request and insert it in a DIV. I need to perform some extensions on the HTML I load though, which brought me to the idea to create DOM from the loaded markup, extend it and insert it. So my question is: Is there a convenient way to create DOM from a string of HTML-markup? The only way I found, or have been told, is to create a DIV with new Element, insert the markup in it, and remove the DIV again. But I find that kinda hacky. Isn't there a good way for this?
It's OT for this list, but have a look at Prototype.js. You can create a new DOM element in memory, and do all the things you want to it without ever showing it to the user.
var foo = new Element('div', {}).update(my_html).do_stuff_here().innerHTML;
Walter -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
