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

The Archive Base Latest Questions

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

How do I refresh a droppable/sortable container in JQuery? I have an ordered list

  • 0

How do I refresh a droppable/sortable container in JQuery? I have an ordered list with a placeholder list item, that when the user drops a list item, the placeholder is replaced. If the items dropped are in the correct order it will display a message and the user can move on, but if incorrect they receive and alert that it is incorrect, and it is at this point I would like the container to remove the list to start over. I tried $('#bin ol').remove('li'); but it would not allow me to start dropping items back into the container. Is there a simple way to accomplish this?

HTML

<article id="answers">

        <ul>
            <li><a draggable="true" href="#" id="one" name="change" class="imgHvr"></a></li>
            <li class="spaced"><a draggable="true" href="#" id="two" name="obst" class="imgHvr"></a></li>
            <li><a draggable="true" href="#" id="three" name="journey" class="imgHvr"></a></li>
        </ul>

        <div id="bin">
            <div class="ui-widget-content">
            <hr id="topBorder"></hr>
            <h2></h2>
                <ol>
                    <li id="uno" draggable="false" class="placeholder">Add Items Here</li>
                </ol>
            <hr id="bottomBorder"></hr>
            </div>
        </div>

        </article>

JQuery

enter code here$(function() {
var limit = 3;
var counter = 0;
var answerKey = ["journey", "obst", "change"];
var answers = [];

$("#bin ol").sortable({cancel: '.placeholder' });
$("#answers li").draggable({
    appendTo: "body",
    helper: "clone",
    cancel: '.placeholder'
});
$("#bin ol").droppable({
    activeClass: "ui-state-default",
    hoverClass: "ui-state-hover",
    accept: ":not(.ui-sortable-helper)",
    drop: function( event, ui ) {
        counter++;
        if (counter == limit) {
            $(this).droppable("disable");
        }
        $(this).find(".placeholder").remove();
        ui.draggable.clone().appendTo(this);

        $(this).find("#one").attr("id", "one_1");
        $(this).find("#two").attr("id", "two_1");
        $(this).find("#three").attr("id", "three_1");
    }
});

$("#subBtn").click(function() {
    var answers = [];
$('#bin a').each(function() {
    answers.push($(this).attr('name'));
}); 

if (arraysEqual(answerKey, answers)) {
    $("#bin ol").append('<a href="index.html" name="modal"><img id="correct" src="images/visSelect/seq_correct.png"></a>');
    $("#submitBtn input").attr('disabled', 'disabled');
}else{
    alert('Please Try Again');
    /* $('#bin ol').remove('li'); */
}

});
  • 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:26:20+00:00Added an answer on June 15, 2026 at 12:26 pm

    I’d suggest this:

    if (arraysEqual(answerKey, answers)) {
        $("#bin ol").append('<a href="index.html" name="modal"><img id="correct" src="images/visSelect/seq_correct.png"></a>');
        $("#submitBtn input").attr('disabled', 'disabled');
    }else{
        alert('Please Try Again');
        $('#bin ol').html(create_droppable());
    }
    
    function make_droppable(){
        return '<li id="uno" draggable="false" class="placeholder">Add Items Here</li>';
    }
    

    And then if possible, add onload="$('#bin ol').html(create_droppable());" to your body tag.

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

Sidebar

Related Questions

I have a refresh button on my iphone screen that refreshes a table in
I have a refresh button that executes a function to initiate a request and
I have a refresh menu item in the action bar and my main layout
Refresh an int64edit and get selected element. I have an int64edit, when I select
I want to refresh a table using a SSIS package every time the user
How to refresh only an element of a HTML page with Jquery or Javascript
I have a refresh function. Which will have to compare each row of given
I need to refresh a panel that has autoLoad content. var contentPanel = new
I'm creating a day planner using jquery, draggable and droppable. When a job is
I want to refresh a div tag in Django that contains temperature data. The

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.