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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:58:31+00:00 2026-05-24T03:58:31+00:00

I would like to have a <input type=text value=VARIABLENAME />. Is there anyway I

  • 0

I would like to have a

      <input type="text" value=VARIABLENAME />. 

Is there anyway I can do this? Putting value = “VARIABLENAME” interprets it as the name of the variable. But I would like to assign the content of the variable to the value property.

EDIT: The variable is from the text content of one of my tables. I got the variable by using doing something like this in my script tag.

       selectedScheduleName = e.target.childNodes[0].wholeText; 

Thank you.

  • 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-24T03:58:33+00:00Added an answer on May 24, 2026 at 3:58 am

    Yes, you can assign a value to the input’s value property from a variable, e.g.:

    theInput.value = theVariable;
    

    You do this in the JavaScript, after getting a reference to the input element.

    So for instance, if you give the input an id value of “foo”, you can do this:

    document.getElementById("foo").value = theVariable;
    

    …within a script tag. (Be sure that the input has already been added to the DOM first, either by putting the script after it — the bottom of the body tag is good — or by using window‘s load event or, if you use a library that supports one, some kind of “dom ready” event.)

    The element doesn’t have to have an id, if you can get at it via getElementsByTagName or by the form element’s elements array, etc., etc.

    Handy references:

    • DOM2 Core specification (well supported cross-browser)
    • DOM2 HTML specification (reasonably well supported cross-browser)
    • DOM3 Core specification (not quite as well supported cross-browser yet)
    • The HTML5 specification now has IDL for the HTML DOM objects in it directly (supplanting/supplementing the DOM2 HTML spec), such as for HTMLElement, HTMLFormElement, and HTMLInputElement
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some hidden inputs like this <input name=exam.normals[1].blahblah ..../> I would like somehow
I have an input box like the following: <input type=text value= somethingSpecial=filename.txt id=myID class=box>
I have this code basis: echo '<input required type = text name = subject1
Assume I have the following input in Pig: some And I would like to
I have byte array as input. I would like to convert that array to
I would like to have a nice template for doing this in development. How
I have a fixed width input of type text. If the user was to
I have a form with some fields of type text and 2 fields (name
I have some jQuery that takes the value of a text input and puts
So I have the following html: <div id=divForComponents> <input type=button value=+ onclick=addFilter('divForComponents')/> </div> And

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.