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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:14:48+00:00 2026-05-16T14:14:48+00:00

I have two divs that are float:left: <div id=inventor> <table> <tr id=1><td>Alexander Graham Bell</td></tr>

  • 0

I have two divs that are float:left:

<div id="inventor">
<table>
<tr id="1"><td>Alexander Graham Bell</td></tr>
<tr id="2"><td>Thomas Edison</td></tr>
<tr id="3"><td>Nicholas Tesla</td></tr>
</table>
</div>
<form>
    <div id="invention">
        <table>
        <tr><td><input name="answer1" />Tesla coil</td><td>Explanation</td></tr>
        <tr><td><input name="answer2" />Telephone</td><td>Explanation</td></tr>
        <tr><td><input name="answer3" />Phonograph</td><td>Explanation</td></tr>
        <tr><td><input name="answer4" />Light bulb</td><td>Explanation</td></tr>
        </table>
    </div>
</form>

and I want to be able to drag the inventor over to the invention.

$("#inventor tr").draggable({
    revert: "valid"
});

$("#invention tr").droppable({
    drop: function(event, ui) {
        var inventor = ui.draggable.text();
        $(this).find("input").val(inventor);
    }
});

I was able to get this working with list elements, but now that I’m adding an explanation to the invention table, I’d like to use a table on the left-hand side for styling purposes.

  • 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-16T14:14:49+00:00Added an answer on May 16, 2026 at 2:14 pm

    This may do the trick. Changes:

    • Wrapped the tr elements inside tbody
    • Added a helper clone when dragging a tr. Only way I could make the dragging actually work. (Tell me if you don’t want this (you want the tr to be removed from the table when you start dragging) and we’ll see if we can find a solution)

    The javascript. When the dragging starts, a clone is made (because of helper: "clone") and the c variable will holw reference to the clone and the tr being dragged. When the dragging stops, if it is outside a droppable, the clone is destroyed. If it is inside the draggable, we destroy the clone and the tr (so it is removed from the list and can’t be dragged again)

    //this will hold reference to the tr we have dragged and its helper
    var c = {};
    
    $("#inventor tr").draggable({
            helper: "clone",
            start: function(event, ui) {
                c.tr = this;
                c.helper = ui.helper;
            }
    });
    
    
    $("#invention tr").droppable({
        drop: function(event, ui) {
            var inventor = ui.draggable.text();
            $(this).find("input").val(inventor);
    
            $(c.tr).remove();
            $(c.helper).remove();
        }
    });
    

    The only new to the HTML is the wrapping of the trs inside tbody tags.

    Here’s a demo: http://jsfiddle.net/UBG9n/1/

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

Sidebar

Related Questions

I have a div with two nested divs inside, the (float:left) one is the
I have a container div that holds two internal divs; both should take 100%
Suppose I have an div. Inside this div, I have two divs floating left,
When I have three divs that all have float left I want the sections
i have two divs side by side (via float:left). on this two divs i
I have a div which contains two nested divs, one that specifies a height
Please see this fiddle . Essentially, I have two divs which have float: left;
I have two divs and two separate links that triggers slideDown and slideUp for
I have two divs. I would like to move/populate the text from div id
i have two divs one floated to the left and the other to 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.