How to change an <input> field's VALUE attribute in real time with JavaScript?

how to change a wheel
how to change a tire - youtube
how to change a tire on a rim
how to change a tyre on a rim
how to change a tire by hand
how to change car tyres at home
how to change a tire wikihow
how to change a tire on a bike

I want to change the value of an input field in real time as the user types in another input field, preferably using regular JS and not JQuery.

Example: User types a random value into #input_1, and at the SAME TIME, #input_2 receives whatever the user is typing and sets it at its value.

If the user deletes a number from the #input_1 value, #input_2 follows and deletes the same number from its value.

This all in real time and preferably without a button press to trigger the function that does this.

Easy ;)

<input id="input1" onkeyup="document.getElementById('input2').value=this.value" />
<input id="input2" />

How To Change A Tyre: A Simple Guide, A jack; A wheel brace. changing tyre equipment Most modern vehicles will come equipped with tyre-change equipment and a spare. Source:  How To: Change Yourself in Positive Ways Get real with yourself.. If you’ve been stuck in trying to resolve problems with finances, health, relationships, career Build a support network.. Recent studies indicate that people you spend time with affect your habits, whether good or Take baby

There are lots of ways to implement this. Here's how I would do it:

HTML:

<input id="sourceField" />
<input id="destinationField" />

JS:

// When the page is done loading and rendering...
window.addEventListener('DOMContentLoaded', ()=>{
    // Get the appropriate elements
    const sourceField = document.getElementById('sourceField')
    const destinationField = document.getElementById('destinationField')

    // When the user types some input into the first text field...
    sourceField.addEventListener('input', ()=>{
        // Set the value of the destination field to the value of the source field.
        destinationField.value = sourceField.value
    })
})

How to Change a Tire, Nothing takes the joy out of a road trip like a flat tire. Do you know how to change it? We didn't Duration: 5:35 Posted: 30 Jan 2008 Here's the easy way to change your computer's name: 1. Open Settings and go to System > About. Sarah Jacobsson Purewal/CNET 2. In the About menu, you should see the name of your computer next to PC name and a button that says Rename PC. Click 3. Type the new name for your computer. You can use

you can do it like this

You need to select the first input (on an event) and take value from that input and update in the second one.

function handle(e){
  var input1 = document.getElementById('input1').value;
  console.log(input1)
  document.getElementById('input2').value = input1;
}
<input id='input1' onkeyup="handle()" value=""/>
<input id='input2'  value="" />

How to Change a Car Tyre, Mark Short from drive.com.au shows you how to safely and easily change a flat tyre. Subscribe Duration: 3:42 Posted: 30 Jan 2013 Learn the best ways to gain support for your cause and make change! 1. Create your petition. Write a clear, personal story, and choose a specific decision maker so more people will understand and support your goal 2. Share your petition. 3. Build momentum. 4. Reach out to the media. 5. Engage

How to change a tyre, Learning how to change a tyre is a very important skill to have in Australia so you don't end up stranded by the side of a remote road. While it could seem difficult  Petition to change your name by filling out a name change form, an order to show cause for legally changing your name, and a decree to legally change your name. Take these forms to the court clerk and file them along with your state's required filing fees. In most cases, a judge or magistrate will review your forms and grant the name change.

Change the email address for your account - Computer, Change the email address for your account. In some cases, you can use a different email address (username) to identify your Google Account. How to change account name using Settings. Open Settings . Click on Accounts . Click on Your info . Click the Manage my Microsoft account option. Source: Windows Central. Sign in with your credentials (if applicable). Under the account picture, in the top-left, click the More actions menu. Select

How to change a tyre | Guide to changing a flat tyre, It's not fun, but we all sometimes have to change a tyre (or change a tire). It's not a hard job! Here's how to change a tyre in 5 steps. Here, we'll show you how to change your Twitter handle, as well as how to change it on Twitter's Mobile App. Disclaimer: If you change your username, your followers will see a new username next to your profile -- but it won't necessarily affect your existing followers, Direct Messages, or replies.

Comments
  • Did you google this?
  • @YaakovAinspan Tried, but couldn't find anything that fits what I'm looking for.
  • inp1.oninput=x=>inp2.value=inp1.value;
  • jsfiddle.net/yak613/dn6h0fre This took me less than a minute to do :)
  • Without capturing a button press the only way would be to use a timeout/interval. That would be way less efficient.
  • This will certainly work, but in general it is recommended to not use inline Javascript attributes. Doing so encourages repetitiveness of code and blurs the separation of concerns.
  • @RobertAKARobin Depends on the use dude ;)
  • Do you need the DOMContentLoaded? As long as it's below the element it should be fine
  • @YaakovAinspan You're correct, but we don't know where OP will be putting this JS, so I prefer to include it.
  • I'd be adding it to the page itself, if that's what you mean. Not in a separate .js file.
  • @PolarDog Regardless of whether your JS is in a separate file or inline in your HTML, if the <script> element that loads it comes after the <input> elements in your HTML, you don't need the DOMContentLoaded. But I like putting my <script> elements in the <head> of my HTML.
  • I keep it just under my <head> but above my <body>.