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 7195197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:31:51+00:00 2026-05-28T20:31:51+00:00

I am new to jQuery and currently blocked at (I suppose) a simple issue.

  • 0

I am new to jQuery and currently blocked at (I suppose) a simple issue.

I have two lists: a droppable and a draggable; 2 questions about that:

1) How to know the items that are dropped?
So list all the items that are in the “dropped” zone.

2) How to check if the dropped items are in the correct drop zone?
Each have an ID and should be dropped in the correct zone (drag1 to drop1).

Doing this “live” is easy, just check if ID of UI is the same as the ID of the $(this) with the drop-function.

But I want to allow the drop always and recalculate each time how many are dropped correctly.
You can use a counter but the remove option (see example) will make that too complicate.

In short, how to iterate the droppables and check if the dropped one on it, is correct.

CODE : http://jsfiddle.net/setki/BCnyU/

  • 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-05-28T20:31:52+00:00Added an answer on May 28, 2026 at 8:31 pm

    OK, I found a solution, although I am not too happy with it because it looks “strange”.

    What I do is add an extra Class to the Droppable: “OK”.
    It’s a class that has no style (but can be used for styling if wanted).

    if (dragID == dropID) {
      $(this).addClass('OK');
    } else {
      $(this).addClass('NOK');
    }
    

    Then I just count all those who have that style

    var numItems = $('.OK').length;
    $('.counter').html('Correct: '+numItems +'/5');
    

    And not to forget, remove the class also if draggable is removed from droppable

    $(this).removeClass('OK NOK');
    

    Well, anyone can use this simple solution, but I am keen to know if there really are no other solutions in jQuery.

    The working example can be found at: http://jsfiddle.net/setki/BCnyU/

    Have fun!

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

Sidebar

Related Questions

I have application that brings response via Ajax and creates 5-20 new jQuery click
I am new to JQuery library. I am currently trying to create a Draggable
I'm rather new to jquery so this may be the issue. I have a
I'm still quite new with jQuery, I know that I could google and have
Currently, I have this line: $.post(submitmail.php, $(#contactform).serialize(), recvMailStatus); I'm new to jQuery so this
Scott Guthrie just blogged about the new jQuery Templates that his team has been
I'm fairly new to JQuery and for some reason I can't get the currently
I'm currently new into client-side programming, especially using the Jquery Ajax method to call
I'm currently working on a new Magento template, and I'm facing problems with jQuery.
I am very new to web development. I am currently using tablesorter jquery plugin

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.