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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:56:41+00:00 2026-06-15T01:56:41+00:00

I am using the autocomplete widget on my form which is basically providing a

  • 0

I am using the autocomplete widget on my form which is basically providing a depart city text input field and a return text input field.

I would like to show in one div the Depart From, and Arrive At and in a second div the return information which would be the same. (i.e. Depart Toronto to Barrie and the Return, Barrie to Toronto).

My jQuery is working fine to display the information the first time but I can’t get the information to show again reversed.

My form: (only displaying part)

<div class="ui-widget">
    <p>
        <label for="tags">Depart From:</label>
        <input type="text" class="departCity" id="tags" size="30" />
    </p>
</div>
<div class="ui-widget">
    <p>
        <label for="tags2">To:</label>
        <input type="text" class="destination" id="tags2" size="30" />
    </p>
</div>

My code is:

$(function() {
    $('input[type="text"]').blur(function() {
        $("#" + $(this).attr('id') + "_display").html($(this).val());
    });
});​

And html:

<div id="trip">
    <p><strong><span id="tags_display"></span> - <span id="tags2_display"></span></strong></p>
</div>
<div id="returnTrip">
    <p><strong><span id="displayTags2"></span></strong></p>
</div>

As I said, the first part in the “trip” div displays fine but I would like to clone/duplicate it in the second.

I tried this and some other variations but can’t get it to display a second time. My form data is not going anywhere, it will only be displayed.

function open() {
    $('#displayTags2').html($('#tags2_display').clone());
}
open();​

Thanks in advance for any help.

  • 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-15T01:56:42+00:00Added an answer on June 15, 2026 at 1:56 am

    You need a way to call the copying function that you have (what you have called open()).

    You could create a button to add the trips to the list:

    HTML

    <div class="ui-widget">
        <p>
            <label for="tags">Depart From:</label>
            <input type="text" class="departCity" id="tags" size="30" />
        </p>
    </div>
    
    <div class="ui-widget">
        <p>
            <label for="tags2">To:</label>
            <input type="text" class="destination" id="tags2" size="30" />
        </p>
    </div>
    
    <div id="trip">
        <p><strong><span id="tags_display"></span> - <span id="tags2_display"></span></strong></p> 
    </div>
    
    <button class="copyTrip">Copy trip</button>
    
    <div id="returnTrip">
        <p><strong><span id="displayTags2"></span></strong></p>
    </div>
    ​
    

    Javascript

    $(function() {
        $('.copyTrip').on('click', function open() {
            $('#displayTags2').append($('#trip').clone());
        });
    
        $('input[type="text"]').on('change', function() {
            $("#" + $(this).attr('id') + "_display").html($(this).val());
        });
    });​
    

    Demo

    Edit 1

    So you just want to copy the destination value and put it in a hidden div? Easy.

    I would copy the $('#tags2').val() each time it’s changed, and just hide the returnTrip div unless your return trip checkbox is checked.

    Javascript

    $(function() {
    
        $('input[type="text"]').on('change', function() {
            $("#" + $(this).attr('id') + "_display").html($(this).val());
            $('#displayTags2').html($('#tags2').val());
        });
    
    });​
    

    Demo

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

Sidebar

Related Questions

I want to fill a text input in my form using an autocomplete widget
I have a form with a text field that uses jQuery-UI autocomplete widget. I'm
I am using jQuery autocomplete and would like to limit the showing results only
I'm using jQuery autocomplete plugin from jQuery website calling the controller url which return
I'm using the AutoComplete UI widget for a form to allow users to type
I am using jqueryui autocomplete widget for autocompleting a 'country' field but I am
When using the YUI3 Autocomplete widget with a URL source which returns JSON data,
I am using jQuery Ui Autocomplete 1.8.14 and I would like to do two
Im using Jquery widget Autocomplete.My data source is a server-side script which returns JSON
I'm using the PrimeFaces p:autoComplete widget in a search form of my project. 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.