Hi all, I have some HTML as follows and I want it so when you click on an <li> it returns the dd3-content and url.

<div class="dd" id="nestable3">
    <ol class="dd-list" id="start">
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">Home</div>
            <div class="url" style="display:none;">homeurl</div>
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">About Us</div>
            <div class="url" style="display:none;">abouturl</div>
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">Gallery</div>
            <div class="url" style="display:none;">galleryurl</div>
            <ol class="dd-list">
                <li class="dd-item dd3-item">
                    <div class="dd-handle dd3-handle"></div>
                    <div class="dd3-content">Contact</div>
                    <div class="url" style="display:none;">contacturl</div>

My problem is if it more than one level deep. It is returning the li above it as well

I just need the level clicked. Also I'm looking to write a delete option to delete the <li> clicked and the immediate ones below it. I can, if needed give each <li> a unique id. How can I achieve this.


Use: http://api.jquery.com/event.stoppropagation/

It stops the event from "bubbling up".

Perfect solution, but don't forget to pass "event" as the function's parameter. Won't work (in some browsers) otherwise.


Thanks guys that's just great. Now I need a way to click on a <li> item and change the dd3-content field and url field. I have decided to give each li item a unique id.

So how may I do this? And I need a way to delete a selected node.

I'm really struggling with the update... I think I can do the remove since I've assigned each li and unique id.

Please can you help me with the update, here is my latest fiddle.


Man... it's so simple:


Damn, so it is. I so suck at jquery. I guess this is solved. Thanks

I just realised the replace html isn't working properly I needed to add:


To limit it to the li clicked.