Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7727549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:29:13+00:00 2026-06-01T05:29:13+00:00

Drag is not working after dropping on the area. I have used Jquery UI

  • 0

Drag is not working after dropping on the area. I have used Jquery UI for this. How do I re drag the buttons? I dont want to to stick it in a particular position so that i can reposition it any where on the board.

Here is the link http://www.onlinedemowebsite.com/design/swatch/drag-and-drop/

<script type="text/javascript">
$(document).ready(function(){
     for (var i = 1; i <= 225; i++) {
         $('.board').append($('<div/>',{id:"cell_"+i}));
    }
     $('.board div').addClass('cellBox');
     $('.board .cellBox').append('<span>Drop</span>');

     $(".letters").draggable({
            revert: true,
            snap:true,
            snap: '.cellBox', snapMode: 'inner', snapTolerance:40,
      });

    $( ".board" ).droppable({
         activeClass: 'ui-state-hover',
         hoverClass: 'ui-state-active', 

         over: function(event, ui) {
             $('.ui-draggable-dragging').addClass('lettersBig');
         },
          out: function(event, ui) {
            $('.ui-draggable-dragging').removeClass('lettersBig');
         },
         drop: function( event, ui ) {
            $('.ui-draggable-dragging').addClass('onCell');
            $(ui.draggable).draggable('enable');

            if (ui.draggable.is('.letters')) {
            $(this).addClass('ui-state-highlight').find('span').html('got!');
            // cloning and appending prevents the revert animation from still occurring
            ui.draggable.clone(true).css({position:relative,top:0,left:0}).appendTo($(this));
            ui.draggable.remove();

             } else {
            $('.cellBox > span').html('No!')
              setTimeout(function(){ $('.cellBox > span').html('Drop'); }, 1000);

           }
        }

    });

})

the HTML code is following

<div class="container">
<div class="board">
</div>
<!--/board-->

<div class="lettersContainer">
    <div class="letters">
        <span>A</span>
    </div>
    <!--/letters-->

    <div class="letters correct">
        <span>X</span>
    </div>
    <!--/letters-->

    <div class="letters">
        <span>M</span>
    </div>
    <!--/letters-->
</div>
<!--/lettersContainer-->

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:29:15+00:00Added an answer on June 1, 2026 at 5:29 am

    I think you are not making the item draggable after dropping and appending

    drop: function( event, ui ) {
            $('.ui-draggable-dragging').addClass('onCell');
            $(ui.draggable).draggable({
                revert: true,
                snap:true,
                snap: '.cellBox', snapMode: 'inner', snapTolerance:40,
            });
    
            if (ui.draggable.is('.letters')) {
            $(this).addClass('ui-state-highlight').find('span').html('got!');
            // cloning and appending prevents the revert animation from still occurring
            ui.draggable.clone(true).css({position:relative,top:0,left:0}).appendTo($(this));
            ui.draggable.remove();
    
             } else {
            $('.cellBox > span').html('No!')
              setTimeout(function(){ $('.cellBox > span').html('Drop'); }, 1000);
    
           }
        }
    

    //edited

    $( ".board" ).droppable({
             activeClass: 'ui-state-hover',
             hoverClass: 'ui-state-active', 
    
             over: function(event, ui) {
                 $('.ui-draggable-dragging').addClass('lettersBig');
             },
              out: function(event, ui) {
                $('.ui-draggable-dragging').removeClass('lettersBig');
             },
             drop: function( event, ui ) {
                $('.ui-draggable-dragging').addClass('onCell');
                $(ui.draggable).draggable('destroy');
    
                if (ui.draggable.is('.letters')) {
                $(this).addClass('ui-state-highlight').find('.cellBox').html('got!');
                // cloning and appending prevents the revert animation from still occurring
                var objectClone = $(ui.draggable).clone();
                $(objectClone).css('position','relative').position({top:0,left:0});
                $(objectClone).draggable({
                    revert: true,
                    snap:true,
                    snap: '.cellBox', snapMode: 'inner', snapTolerance:40,
                });
                $(this).append($(objectClone));
                ui.draggable.remove();
    
                 } else {
                $('.cellBox > span').html('No!')
                  setTimeout(function(){ $('.cellBox > span').html('Drop'); }, 1000);
    
               }
            }
    
        });
    

    i have changed the droppable function a little bit. It has some glitches but try it once and see yourself

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do a simple drag-drop using jQuery. I have not done anything
this is the problem: I'm using javascript and JQuery (not UI) to drag nested
I have two problem, This nestedSortable is not working in this code, where's the
I have a Phonegap/jQuery application which is working great, however in one area the
I used mouseup/down/move to manually implement jQuery.draggable functionality. Everything was working fine until I
I have a jquery scrollable that is not constrained to be within it's parent.
I have a jquery plugin that i'm working with for a website and I
I've got a drag and drop UI basically working with jquery ui and backbone.js.
I want to allow dropping of image files in my application: Users can Drag
This is my sample code. The select function is not working. What I'm doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.