byobob
byobob

Reputation: 99

Input text into two different HTML input boxes at the exact same time

Is there a way where a user can enter text into an HTML input box and have the same exact text appear in another input box in real time? So not using "onclick" or anything like that. I need it to be entered into the second textbox exactly while it's being typed in the first one.

I'm looking for a solution using HTML, CSS and VBScript. My script is for an application, not for use in a web browser. I can try to convert some JavaScript code but frankly, I have to use VBScript unfortunately.


Here is some code I tried to put together:

Function syncInput()
    var syncinput = document.getElementById.(".inputs").value
    syncinput.keyup = this.val
End Function

Here is the front end code:

<input onclick="InputComputerName" class="inputs" type=text id="ComputerName" name=ComputerName /><br><br>

<input class="inputs" type=text id="RegionCode" name=RegionCode onkeyup="syncInput"><br><br>

I've seen some JQuery code on what I'm trying to do, and then trying to convert it over to VBScript but I'm missing something.

Upvotes: 2

Views: 2876

Answers (2)

Maulik Patel
Maulik Patel

Reputation: 670

you can do it without query i think like this,

<input type="text" id="left" name="left" oninput="right.value = left.value; return true;" />
<input type="text" id="right" name="right" oninput="left.value = right.value; return true;" />

Upvotes: 1

mplungjan
mplungjan

Reputation: 178285

I never write VBScript, but I assume this will work

Sub RegionCode_OnKeyUp()
  ComputerName.Value = RegionCode.Value
End Sub

Upvotes: 1

Related Questions