• Parent1
      child1
  • Parent2
      child2
      child2.1
    • Parent1
        child1
    • Parent2
        child2
        child2.1
      • Parent1
          child1
      • Parent2
          child2
          child2.1
      • DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        how to drag only child elements inside nested ul tags using jquery ui draggable

        1.4k Views Asked by Sukanya Moorthy At 30 December 2013 at 06:34 2025-12-21T02:12:16.198000
        My list is something like this
        <div id="jqxTree">
            <ul>
                <li>Parent1
                    <ul>
                        child1
                    </ul>
                </li>
                <li>Parent2
                    <ul>
                        child2
                    </ul>
                    <ul>
                        child2.1
                    </ul>
                </li>
            </ul>
        </div>
        

        when i use jquery draggable its dragging entire list.How to i drag only child1,child2,child2.1 elements .To generalise i wanna drag only li elements inside ul which is inside li..

        I tried using the below function but on mouseover the elements of li the elemnts get hidden

        $('#jqxTree').delegate('li li', 'mouseover', function () {
            $(this).draggable({
                revert: true,
                revertDuration: 0
            });
        }); 
        
        jquery jquery-draggable jquery-droppable
        Original Q&A
        1

        There are 1 best solutions below

        1
        Deryck Deryck On 30 December 2013 at 06:43 BEST ANSWER

        According to jQuery API page:

        As of jQuery 1.7, .delegate() has been superseded by the .on() method.

        Fiddle Demo

        jQuery:

        $(function () {
            $('#jqxTree').on('mouseenter mouseover', 'li > ul', function () {
                $(this).draggable({
                    revert: true,
                    revertDuration: 0
                });
        
            });
        });
        

        In CSS, use > between parent and child elements.

        Also you had li li instead of li ul.

        Related Questions in JQUERY

        • In Datatables, start value resets to 0, when column sorting
        • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
        • window.location.href redirects but is causing problems on the webpage
        • Using JQuery Date Slider
        • Storing selected language in localStorage
        • How to stop other divs from still showing when i click a different button?
        • Check multiple values with jQuery
        • Bootstrap component does not want to render in Datatables function
        • put white spaces when entering an amount moneytype symfony
        • Trouble accessing custom header in AJAX response using jQuery in Fiware Keyrock
        • I just cant make it work, HTML, JS and Firebase error
        • Didn't declared variable still not getting any error in JavaScript
        • Move element horizontally while scrolling vertically in pure JavaScript
        • allow multi carousel in same page
        • Embedded TikTok posts / thumbnail styling issue

        Related Questions in JQUERY-DRAGGABLE

        • Get the elements id already in the droppable div
        • How can i tell if an draggable element is dropped on another draggable element, with Jquery?
        • How to set width and height to draggable image?
        • JQuery Draggable - Prevent grid objects from going in the same position
        • How to trigger jQuery drag() function manually? like $(element).trigger('drag');
        • Jquery UI Sortable + Bootstrap variable height Divs sorting issue
        • How to move selected elements using arrow keys
        • Draggable not working after using jquery load function
        • Jquery draggable jumps on click in Chrome
        • Disable draggable for each element using :lt(3) Selector
        • selected added div be draggable
        • Draggabilly not adding event to newly added element
        • jQuery UI Draggable Snap Restore not working
        • Having problems with draggable clone object
        • Draggable object - dragging from title

        Related Questions in JQUERY-DROPPABLE

        • How to be sure every draggable elements have been dropped with jQuery droppable
        • drag and drop - the elements don't drop
        • Can items in a jQuery nested sortable list be dropped into a droppable section?
        • Having problems with draggable clone object
        • jquery draggable containment array values for scaled container
        • Remove cloned image after adding another image with jQuery UI
        • Clone draggable after dropping in targeted area with jQuery UI
        • Contextmenu and DragnDrop on right click using jquery easyUI
        • How to use droppable function of jQuery to a transformed div?
        • jQuery UI Draggable and Droppable
        • jQuery Drag and Droppable - Hide placeholder if droppable area has li elements
        • jQuery Droppable - Not able to remove Cloned Element
        • jQuery - Draggable and Droppable onClick + icon from draggable add to droppable container
        • jQuery Droppable - Dont remove Original CSS class of <li> Tag after dropping
        • Create Carousel after 5 elements has been added

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Pricesm.com
        • Aftereffectstemplates
        • Jogjafile