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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:47:52+00:00 2026-05-31T02:47:52+00:00

I want to implement a page with 2 lists, and it allows user to

  • 0

I want to implement a page with 2 lists, and it allows user to drag and drop items between the two lists. This can be implement by using jQuery UI library:

html:

<!--list A-->
<div id='list_a'>
  <ul class='sortable'></ul>
</div>

<!--list B-->
<div id='list_b'>
  <ul class='sortable'>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
</div>

js:

$( "ul.sortable" ).sortable({
    connectWith: "ul",
    dropOnEmpty: true
});

$( ".sortable" ).disableSelection();

The problem is, when I using jQuery ajax to generate list B, the drag and drop does not work anymore. I suspect that the jQuery is unable to select the ul .sortable, because when I view the HTML source, I can only see <div id='list_b'></div>.

My ajax code:

$('#field_a h3 a').click(function() {
    var form_data = {
        required_data:$(this).text().trim(),
        ajax: 1
    };

    $.ajax({
        url: 'get_list_b',
        dataType: 'html',
        type:'POST',
        success: function(msg){
            $('#list_b').html(msg);
        }
   });
});

I am using CodeIgniter. Any idea?

  • 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-31T02:47:53+00:00Added an answer on May 31, 2026 at 2:47 am

    the first:

    what is the element $(‘#field_a h3 a’) ?

    second:

    it doesn’t work because when you do that $(‘#list_b’).html(msg) – you are removing the UL element.

    So, your binds referencing to the unexisting element.

    you can do like that:

    $.ajax({
            url: 'get_list_b',
            dataType: 'html',
            type:'POST',
            success: function(msg){
                var list=$('#list_b');
                list.html(msg);
                $( "ul.sortable",list ).sortable({
                    connectWith: "ul",
                    dropOnEmpty: true
                });
            }
       });
    

    and it could be more helpful if you could put your example to http://jsfiddle.net/

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

Sidebar

Related Questions

I want to implement a search in my Android application. In this page, first
I want to display some drop-lists in the web page, so I created table,
im trying to implement a custom error page, what i want to be able
given this class definition: public class Frame { IFrameStream CapturedFrom; } I want implement
I want to implement a two-pass cache system: The first pass generates a PHP
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running
I started trying to implement drag-and-drop of virtual files (from a C# 4/WPF app)
I want to implement something as follows: The user uploads different types of files
I am using xslt and I want to implement sorting on my href link.
I want implement in my software solution an VBA editor but in c# 3.0.

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.