Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    333
    Thanks
    38
    Thanked 0 Times in 0 Posts

    JQuery draggable does not work

    I am having issue in drag and drop in JQuery, here the link, the div is not dragged:

    http://jsfiddle.net/FZrZk/

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,391
    Thanks
    11
    Thanked 568 Times in 561 Posts
    You'll have to move the call to .draggable() into a $(document).ready() handler so that the DOM has been loaded before you try to access DOM elements.

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    333
    Thanks
    38
    Thanked 0 Times in 0 Posts
    thank, it works. another issue, i want to set the contenteditable to ON so that I can write. but it seems after set it to ON, i still cannot write. Before I made it draggable, it did work. but now not.

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,391
    Thanks
    11
    Thanked 568 Times in 561 Posts
    The .draggable() will "hijack" the click event, therefore the contenteditable still works but not when clicking on the DIV. It will still work when you tab to the element, though.

    Workaround: Introduce a drag-handle element to the draggable, so that you can only drag the element with the handle. Then the contenteditable element of the draggable will still react on click


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •