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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:42:42+00:00 2026-05-30T19:42:42+00:00

I have drag&drop jQuery script for dragging list items to input. How do I

  • 0

I have drag&drop jQuery script for dragging list items to input. How do I get text between li to set input value? I now that $this refers to droppable element.

My code is below:

    <script type"text/javascript">
        $(function() {
            $( ".draggable" ).draggable({
                revert: "valid"
            });
            $( ".droppable" ).droppable({
                drop: function( event, ui ) {
                $( this )
                    .find( "input" )
                    .val( "?" )
                }
            });
        });
    </script>
</head>
<body>
<div class="left">
    <ul>
        <li class="draggable">one</li>
        <li class="draggable">two</li>
        <li class="draggable">three</li>
        <li class="draggable">four</li>
    </ul>
</div>
<div class="right">
    <form>
        <div class="droppable">First <input class="droppable" type="text" name="first" value="" /></div>
        <div class="droppable">Second <input class="droppable" type="text" name="second" value="" /></div>
        <div class="droppable">Third <input class="droppable" type="text" name="third" value="" /></div>
        <div class="droppable">Fourth <input class="droppable" type="text" name="fourth" value="" /></div>
    </form>
</div>
  • 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-30T19:42:43+00:00Added an answer on May 30, 2026 at 7:42 pm

    Try:

    function( event, ui ) {
               $( this )
                   .find( "input" )
                   .val( $(ui.draggable).text() )
               }
    }
    

    The ui.draggable param is the draggable element that have been dropped.

    Quoting Jquery-UI:

    All callbacks receive two arguments: The original browser event and a
    prepared ui object, view below for a documentation of this object (if
    you name your second argument ‘ui’):

    ui.draggable – current draggable element, a jQuery object. ui.helper –
    current draggable helper, a jQuery object ui.position – current
    position of the draggable helper { top: , left: } ui.offset – current
    absolute position of the draggable helper { top: , left: }

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

Sidebar

Related Questions

I have an application with a file and folder list control which supports Drag&Drop
I have a problem with jQuery Drag&Drop. I have a draggable element and lots
I have a page that makes use of jQuery Drag & Drop, and I
I have a jQuery-UI sortable list of items. I want to drop an element
I have 2 spark lists with items, drag&drop enabled (mxml application, flash builder 4).
i have a treview control with drag&drop functionality that response to draw the node
I have created a nested list with drag/drop functionality. My issue is that I
I have a problem: I've add a Jquery UI drag-n-drop widget to my page,
I have implemented my custom drag&drop by deriving from COleDataSource and COleDropTarget. Everythings work
Does anyone have an idea how I can disable Drag & Drop for all

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.