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

  • Home
  • SEARCH
  • 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 4077170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:31:00+00:00 2026-05-20T17:31:00+00:00

EDIT I am still baby in writing Javascript and I need your help in

  • 0

EDIT

I am still baby in writing Javascript and I need your help in understanding how it works so please bear with me.

Say, if I want to have “Singapore” append to the textfield on the webpage automatically when the user picks “Singapore” in country select dropdown, how or where do I need to append the “Singapore” text to the state/city textfields on webpage? See image example.

enter image description here

HTML code

enter image description here

Javascript

function appendtoText(){

var country = document.getElementById("billing_country_select");
var state = document.getElementById("billing_province_input");
var city = document.getElementById("billing_city");
if (country.value == "Singapore"){

    state.value = state.append("Singapore");
    alert(state.value);
    city.append("Singapore");

}

}

I am not sure where I went wrong with this. State and City don’t show the appended text: Singapore. So please correct me if I went wrong in coding.

Thanks for the help in advance

  • 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-20T17:31:00+00:00Added an answer on May 20, 2026 at 5:31 pm

    To add the value of the Country field to the state field:

    $(document).ready(function() {
        $('$billing_country').change(function() {
            $('$billing_province_input').val(' - ' + $('$billing_country').val());
        });
    });
    

    When the Billing Country field is changed, the Billing State/Province value automatically becomes ” – Billing Country“. If the chosen country were Singapore, it would become ” – Singapore”. I’m making a very simple assumption about how you want this to work, so if this isn’t what you need, let me know and I will refine it as needed.

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

Sidebar

Related Questions

Edit 4/4/12 I STILL HAVE ONE QUESTION: I solved my issue but it adds
Edit: I still have not resolved this issue. If anyone has advice I would
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
EDIT: Updated with suggestions from Bill Karwin below. Still very slow. I'm trying to
EDIT Taking COST 100 out made the command go through, however, I'm still unable
EDIT: What's weird is even if I comment out <?php get_footer(); ?> it still
-EDIT- <li> would probably be better but the same question still applies. So I
EDIT I still can't assign the process the username of the session id that
I am trying to find out if one can still edit their google ads.
EDIT : I just found something that works on every page load except 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.