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

  • Home
  • SEARCH
  • 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 8947617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:48:39+00:00 2026-06-15T12:48:39+00:00

Hi im trying to make a darg and drop question. I want top use

  • 0

Hi im trying to make a darg and drop question.

I want top use this ++ code:
http://jsfiddle.net/donejs/3NkZM/light/

i want the box to turn green for correct and red for incorrect.

Ie i am drag would be correct
and drag me to to be incorrect

i have tried a few different methods such as:

    $('.drag').on('draginit', function(ev, drag) {
        // Create a ghost for this drag
        drag.ghost();
    });

    $('.drop').on({

        'dropover' : function(ev, drop, drag) {
            $(this).addClass('highlight');
        },
        'dropout' : function(ev, drop, drag) {
            $(this).removeClass('highlight');
        },
        'dropon' : function(ev, drop, drag) {
            if('#correct') {
                $(this).addClass('green')   
            }
            else {
                $(this).addClass('red') 
            };
        };
});

can anyone point me in the right direction ?

  • 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-15T12:48:40+00:00Added an answer on June 15, 2026 at 12:48 pm

    HTML: (you have to say which one is correct)

    <div class="drag correct">
        I am a drag
    </div>
    
    <div class="drag">
        Drag me, too
    </div>
    
    <div class="drop">
        Drop zone
    </div>
    

    JS: (you have to check if the dropped element is “.correct” and, if true, add a “correct” class to the dropzone)

    $('.drag').on('draginit', function(ev, drag) {
        // Create a ghost for this drag
        drag.ghost();
    });
    
    $('.drop').on({
        'dropover' : function(ev, drop, drag) {
            $(this).addClass('highlight');
        },
        'dropout' : function(ev, drop, drag) {
            $(this).removeClass('highlight');
        },
        'dropon' : function(ev, drop, drag) {
            $(this).html('Dropped: ' + drag.element.html());
            $(this).removeClass('highlight');
    
            $(this).addClass('dropped');
            if($(drag.element).is('.correct')) {
                $(this).addClass('correct');
            } else {
                $(this).removeClass('correct');
            }
        }
    });
    

    Add to CSS (color the dropzone):
    ​

    .dropped {
        background-color: red;
    }
    
    .dropped.correct {
        background-color: green;
    }
    ​
    

    DEMO: http://jsfiddle.net/3NkZM/273/

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

Sidebar

Related Questions

Trying to make a text ... loading animation here's where I stand: http://jsfiddle.net/aGfct/ I
Trying to make this function dynamic instead of static. This was the original code
Trying to make a simple jquery drop down here, here's my code so far:
Trying to make a random password generator in VB.NET So far have got this,
Im trying make first person camera in my project. I followed this tutorial http://www.morrowland.com/apron/tutorials/gl/gl_camera_3b.zip
I'm trying make this code which is from a Dictionary of Arrays (CODE) from
I am trying make an OptionsMenu , this is my code: @Override public boolean
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a cross protocol, same domain request from https to http. I

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.