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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:41:55+00:00 2026-06-14T11:41:55+00:00

I have a text field called. It can be cloned. Also there is a

  • 0

I have a text field called. It can be cloned. Also there is a link available to select the value.

I have created a js fiddle to show you.

Full page view: http://jsfiddle.net/ZpEK9/embedded/result/

Source: http://jsfiddle.net/ZpEK9/

As you can see there, if you click the “select a name” link it will popup a window. That window has names and a link to select the name.

I want to insert that name in the text field when the user clock “insert name” link. Can anyone help me with jquery code..

PS: Form fields are clonable.

This is how my code look like..

<form>
    <div class="control-group success">

  <div class="controls">
      <p class="clone"><input type="text" name="name[]"><span class="help-inline"><a data-toggle="modal" href="#myModal">Select a name</a></span></p>
    <span class="help-inline"><a href="#" class="add" rel=".clone">Add More</a></span>
  </div>
</div>
</form>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
           <div class="row-fluid">
            <ul class="thumbnails">
              <li class="span4">
                <div class="thumbnail">
                  <div class="caption">
                    <h3>Sam</h3>
                    <p><a href="#" class="btn btn-primary">Insert name</a></p>
                  </div>
                </div>
              </li>
              <li class="span4">
                <div class="thumbnail">
                  <div class="caption">
                    <h3>Linda</h3>
                    <p><a href="#" class="btn btn-primary">Insert name</a></p>
                  </div>
                </div>
              </li>
              <li class="span4">
                <div class="thumbnail">
                  <div class="caption">
                    <h3>Lucy</h3>
                    <p><a href="#" class="btn btn-primary">Insert name</a></p>
                  </div>
                </div>
              </li>
              <li class="span4">
                <div class="thumbnail">
                  <div class="caption">
                    <h3>Jenifer</h3>
                    <p><a href="#" class="btn btn-primary">Insert name</a></p>
                  </div>
                </div>
              </li>
            </ul>
          </div>
          </div>​

Thanks

  • 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-14T11:41:57+00:00Added an answer on June 14, 2026 at 11:41 am

    I forked your JSFiddle here with a working solution:

    http://jsfiddle.net/jg5C7/3/

    Added ‘select-name’ class to the link:

        <span class="help-inline">
            <a class="select-name" href="#myModal">Select a name</a>
        </span>
    

    Added bindings to the link:

        $('a.select-name').click(function() {
            $('#myModal').data('current-input', $(this));
            $('#myModal').modal('show');
        });
    
        $('#myModal .btn').click(function() {
            $('#myModal').data('current-input').closest('p').find(':text').val($(this).data('value'));
            $('#myModal').modal('hide');
        });
    

    Added data-value attributes to the buttons, example:

        <p><a href="#" data-value="Sam" class="btn btn-primary">Insert name</a></p>
    

    Because you’re using plugins to do some magic, it’s a bit less of an elegant solution but really the only change to what you’re currently doing is I’m manually triggering the modal open / close so that I can hook onto the click event of the “Select Name” link.

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

Sidebar

Related Questions

I have a form on which there is a text field called Role. Onload
I have a text field. If it has wrong values then it may show
I have a text field that is a date, although sometimes it also has
I have a text field in my model called 'about', which I'm trying to
I have table with field called description which contains text like following |Description |
I have quite a few tables with a field called company that can either
I have a text field that uses jQuery UI Datapicker. It also has an
I have a model called Advertisement. This model has text field, title field, and
For example: In my table I have text field with following text: The quick
i have a text field in Contact screen and the user need to enter

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.