.prepend(...children)
Available on: InDom, InDomArrayPrepends one or more HTML strings, DOM elements or InDom objects to the beginning of the underlying element(s).Parameters:
If an argument is a string, it’s parsed as HTML and inserted. Sanitize untrusted strings before passing them.Examples:
...children {(string | Node | InDom)[]} - Content to append (variadic; single array is flattened)
Returns: {InDom | InDomArray} - this for chainingThrows: Error - If the underlying element(s) has been removed
Note: If an argument is a string, it’s parsed as HTML and inserted. Sanitize untrusted strings before passing them.Examples:
// prepend examples (mirror of append examples)
const ul = $1('ul.example-1');
ul.prepend('<li>first</li>'); // string
ul.prepend(img); // DOM Element
ul.prepend($n(img)); // InDom object (same img)
ul.prepend($a('>div', donor)); // InDomArray
$a('>li', ul).prepend('<span>test</span>'); // bulk prepend to every <li> of ulNext: after »