not able to add list item between a list using jquery

Posted by Pradyut Bhattacharya on Stack Overflow See other posts from Stack Overflow or by Pradyut Bhattacharya
Published on 2010-03-25T23:50:10Z Indexed on 2010/03/25 23:53 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

Hi I m having a ordered list having the structure

    1. Test
    2. another test
    3. Add

I want to add a list item between sublist 2 and 3 using jquery

I used the code: -

$("ol#update li ol li:eq(1)").append("<li> test </li>");

But this appends inside the li "another test" and not after the 2 li

Here is the example page

On-click "sub-comment" adds a li inside li 2
Clicking on "comment" shows the structure of the sub lis

Please help

Thanks

Pradyut

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about lists