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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:05:41+00:00 2026-06-10T22:05:41+00:00

I am having this code which i am using to dynamically add new items

  • 0

I am having this code which i am using to dynamically add new items

 <!Doctype html>
    <head>
    <meta charset="utf-8">
    <style type="text/css">
    .tr_deco{
    background-color:pink;
    border:1px solid red;
    }
    </style>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
    <script type="text/javascript">
    jQuery(function() {
    jQuery(".new_krud_slider").click(function(e){
    e.preventDefault();
    jQuery('.krud_dom').append("<form name='krud_submit' action='admin.php?page=exchange_page' method='post'><table class='sortable'><tr class='tr_deco'><td>Slider Title</td><td><input type='text' /></td><td>Slider Description</td><td><textarea></textarea></td><td>Slider Location</td><td><input type='text' name='x' value='Jenna Doe'/></td><td><a href=''>I</a></td></tr><tr class='tr_deco'><td></td><td></td><td></td><td></td><td></td><td><button>Save</button></td><td><button>Delete</button></td></tr></table></form>");
jQuery( ".sortable" ).sortable();
    });
    });
    </script>
    </head>
    <body>
    <a class="new_krud_slider" href="">make new</a>
    <table>
    <tr><td class="krud_dom"></td></tr>
</table>
    </body>
    </html>

​Here is the fiddle http://jsfiddle.net/TRJXe/
I need the dragged item to stay where it has been dropped.

  • 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-10T22:05:43+00:00Added an answer on June 10, 2026 at 10:05 pm

    You’re using the sortable jQuery widget. You need to use the draggable widget

    jQuery( ".sortable" ).draggable();
    

    This will let the item stay where it’s dragged. Using sortable lets you drag items, yes, but when you let go, the item automatically sorts into its new location. Since you only have one item, it will always sort to the top; this is why it jumps back to the same spot after you let go of it.

    UPDATE

    After clarification on the nature of the question, the source of your problem is that you’re calling .sortable on each individual form. To properly use the sortable jQuery UI widget, you need to call .sortable() on the element that contains all the elements you want to sort. In this case, that would be .krud_dom

    So, you’ll want to start by calling .sortable on .krud_dom, like so:

    jQuery( ".krud_dom" ).sortable();
    

    Then, each time you add a new form to the page, you need to “refresh” the widget, with another call to .sortable:

    jQuery( ".krud_dom" ).sortable("refresh");
    

    I’ve created a jsFiddle demo showing how this works:

    — jsFiddle DEMO —

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

Sidebar

Related Questions

Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
Having this code... var b = new ReadOnlyCollection<int>(new[] { 2, 4, 2, 2 });
I'm using some Java code which produces the following interfaces. This code is non-modifiable.
I am having some html which looks like this I need the innerHTML contents
Having a problem with dynamically populated select boxes using jQuery. Basically, my code calls
I'm building a html table dynamically in an ASP.NET code behind file using C#.
Having this code: $main = !empty($searchResults['main']) ? $searchResults['main'] : null; $second = !empty($searchResults['second']) ?
Im having this code %button.aristo-default.accept{:href => #, :onclick => $.post('/sessions/accept_invite', { user_id: 1, friend_id:
Hey im having this code so far - (id)initWithDictionary:(NSDictionary *)aDictionary { self = [super
I am having problems with this code: <?php $new_value = 'testing'; $con = mysql_connect(localhost,user,pass);

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.