after the 3 in the list. I have played with .append and .prepend but witout beeing able to insert at the right place.
Any help would be appreciated
Br. Anders
-----------------------------------
There is a correct answer below. If you use that then it will run through only one level. But same example is is capable of running through multible levels. Just change ('>li>ul') to ('ul') and all nested ul's will be found and handled. Perfect!
(will run through endless levels of nested ul's)
$('#pickme').find('ul').each(function() {
$(this).wrap('
').parent().insertAfter($(this).parent().parent());
});
In this case this:
1
2
3
3-1
3-1-1
Will be:
1
2
3
<
3-1
<
3-1-1
以上就是jquery insert html into list before a child ul-tag的详细内容,更多请关注web前端其它相关文章!