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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:32:33+00:00 2026-05-22T14:32:33+00:00

I have an <input> in my document. There I want the user to do

  • 0

I have an <input> in my document. There I want the user to do some input.

var myVar = document.getElementById('userInput').value;

Then I want this value to be shown in another <input>.

document.getElementById('Preview').value = myVar;

This code somehow doesn’t work.

Can anybody help?

Thanks 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-22T14:32:34+00:00Added an answer on May 22, 2026 at 2:32 pm

    Update based on further information in comments before:

    <button onClick="calculateThatObscenityDeleted()">"Save"</button >
    

    Submit buttons will submit forms, thus running the JS but immediately blanking the form.

    (That might still not be the actual issue, the question is still missing most of the code)


    Original answer before it was revealed that the question didn’t reflect the problem:

    var myVar=document.getElementById('userInput').value;

    Don’t forget the =.

    (And, obviously, you need to use that code in an event handler so it isn’t executed only when the document loads and before the user has typed anything.)

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

Sidebar

Related Questions

i have the following function function change() { var input = document.getElementById('pas'); var input2
I want my form to have a field with a pre-fixed value like this:
We have a lot of input s in a document. We want to open
I am working on templating system. I do have input of html document from
@Oded: Sorry to have been poor in my exposition... My input document has a
<input type=Checkbox checked= name=new> if I have the above html in a document, how
I have an input form with two textareas allowing a user to type in
I want to have the JQuery Datepicker open when the user clicks on an
I have a text document that looks similar to this: R.D. P.N. X Y
I have a page portion as below; <input name=test1 type=text id=test1 class=test1> <button value=hi

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.