Wiki

Clone wiki

LiteQuery / prepend

prepend()

#!javascript

prepend(/* String */ html)

Description

Create element(s) from the given html string and prepend before the selected element.

Example

Inital Markup:

#!html
<body>
    <ul>
        <li id='Li0'></li>
        <li id='Li1'></li>
        <li id='Li2'></li>
    </ul>
</body>
Executing:
#!javascript
lq('#Li1').prepend('<li id="Li0_5"></li>');
Produces:
#!html
<body>
    <ul>
        <li id='Li0'></li>
        <li id='Li0_5'></li>
        <li id='Li1'></li>
        <li id='Li2'></li>
    </ul>
</body>

back to API

Updated