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

The Archive Base Latest Questions

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

I need a JavaScript that will let me auto-populate a text field based on

  • 0

I need a JavaScript that will let me auto-populate a text field based on another field which is a select list type.

Here is my HTML markup:

<div class="attribute-16 even"><div id="edit-attributes-16-wrapper" class="form-item">
 <label for="edit-attributes-16">Position: <span class="form-required">*</span></label>
 <select id="edit-attributes-16" class="form-select required" name="attributes[16]"><option selected="selected" value="">Please select</option><option value="32">Content</option><option value="33">Footer</option></select>
</div> </div>

<div class="attribute-17 odd"><div id="edit-attributes-17-wrapper" class="form-item">
 <label for="edit-attributes-17">Anchor Text: <span class="form-required">*</span>: </label>
 <input type="text" class="form-text attribute" value="" size="60" id="edit-attributes-17" name="attributes[17]" maxlength="128">
</div> </div>

The former field’s value will be automatically entered as the latter field’s value. That’s what I want to do here.

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

    You have to add an event listener to your select field and populate its value to your text field. Your HTML is a little messy.. so I will just write the jquery in general. You can fiddle around with it.

    you have to set this event listener as soon as the body is loaded. So on your HTML

    <body onload="init()" id="stage" class="theme">
    

    and on your javascript

    function init() {
       $("#selectListID").on("change", function(){
          var value = $(this).val();
          $("#inputFieldID").val(value);
       };)
    }
    

    Hope this helps.

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

Sidebar

Related Questions

I need to create a function in JavaScript, that will write some text (which
For a project that will let developers add their own Javascript applications, I need
I am using a javascript validator which will let me build custom validation based
does there exist a service that will let me fetch the contents of another
i need a javascript function that able to check for digit and - only.
I need 2 simple JavaScript functions that read and change the color of a
I need a random object generator in JavaScript that generates a variety of objects
I have an array in javascript that I need to join and send through
I need to create a javascript function that checks if it has been a
So I have these lines of javascript code that I need to remove 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.