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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:27:52+00:00 2026-05-19T03:27:52+00:00

I want my form to have a field with a pre-fixed value like this:

  • 0

I want my form to have a field with a pre-fixed value like this:

New York x

And let the user be able to change it by clicking on the X. In other words they click the X and they get a text field to write whatever they want.

Is there an easy way to do this or is it a lot of code?

—

Box9: After integrating your code it doesn’t input the prefilled value when submitted:

<form class="questionform" name="questionform-0" id="questionform-0">

<textarea class="question-box" cols="12" rows="5"  id="question-box-' . $questionformid . '" name="title"  type="text" maxlength="200" size="28"></textarea>

<span class="prefilled"><script language="javascript"> document.write('' + geoip_city() +''); </script><a href="#"> X</a></span>

<input type="text" name="question" style="display:none">

<input  type="button" name="ask" value="Publicar" onclick="askquestion('questionform-0'); window.location.reload(true);">

</form>

<script type="text/javascript">
$(".prefilled a").click(function () {
    $(this).closest(".prefilled").hide().next().show().focus();
    return false; // Prevent page from jumping to the top
});
</script>
  • 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-19T03:27:53+00:00Added an answer on May 19, 2026 at 3:27 am

    A generic solution, as long as the markup is as below:

    HTML:

    <span class="prefilled">New York <a href="#">X</a></span>
    <input type="text" name="city" style="display:none" value="New York">
    

    Javascript:

    $(".prefilled a").click(function () {
        $(this).closest(".prefilled").hide().next().val("").show().focus();
        return false; // Prevent page from jumping to the top
    });
    

    Seeing that you’re getting the value of “New York” from script and not in the HTML, you might want to set the value of the input like this:

    $("input[name=question]").val(geoip_city());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field in a form. Upon pushing submit, I want to
I want to make a user-registration form where I will have fields such first
I have a dropdown field and its value is pre-selected as soon as its
I have created a form online and when the user clicks submit I want
Say we have a form field and want to populate it with a images
I have a signup form of which most fields are pre-filled using user's Facebook
I'm writing some form. I have one field in this form that contains a
I have a form where I want to be able to duplicate a group
I have a new problem with a Form and the BACK button. Take this
I have a form that i want to auto populate the last 2 fields

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.