[jquery] How to insert element as a first child?

Try the $.prepend() function.

Usage

$("#parent-div").prepend("<div class='child-div'>some text</div>");

Demo

_x000D_
_x000D_
var i = 0;_x000D_
$(document).ready(function () {_x000D_
    $('.add').on('click', function (event) {_x000D_
        var html = "<div class='child-div'>some text " + i++ + "</div>";_x000D_
        $("#parent-div").prepend(html);_x000D_
    });_x000D_
});
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>_x000D_
_x000D_
<div id="parent-div">_x000D_
    <div>Hello World</div>_x000D_
</div>_x000D_
<input type="button" value="add" class="add" />
_x000D_
_x000D_
_x000D_