Edit this page

up.element up.element.createFromHTML(html)
JavaScript function

Creates an element from the given HTML fragment string.

Use up.hello() to activate JavaScript behavior within the created element.


element = up.element.createFromHTML('<div class="foo"><span>text</span></div>')
element.className // returns 'foo'
element.children[0] // returns <span> element
element.children[0].textContent // returns 'text'


html string

A string of HTML from which to create the element.

The given HTML must have a single tag at its root or an error is thrown.