Use my simple plugin Append With Index
:
$.fn.appendToWithIndex=function(to,index){
if(! to instanceof jQuery){
to=$(to);
};
if(index===0){
$(this).prependTo(to)
}else{
$(this).insertAfter(to.children().eq(index-1));
}
};*
Now :
$('- fgdf
').appendToWithIndex($('ul'),4)
Or :
$('- fgdf
').appendToWithIndex('ul',0)