Search code examples
javascriptdommootoolsobject-to-string

Mootools Element to HTML


My question is quite simple.. I need to convert an Element object into an html string

var thumb = new Element('img',{'src':"big.jpg"});
console.log( thumb.?????() ); //some magical method here

should return (as a string)

'<img src="_big.jpg">'

I've tried the .get('html') but it returns nothing, obviously because the img tag has nothing inside.

Thanks in advance


Solution

  • Just proxy it.

    var html = new Element('div').adopt(yourel).get('html');