aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Typing in two text boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Typing in two text boxes" Watch "Typing in two text boxes" New topic

Typing in two text boxes

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
I want to copy contents of one text from one into another this has to happen in real time as if I am typing in two text boxes simultaneously, how can I achieve this using javascript?

Above code lags by one key press.

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
I am trying keypress event but it is showing blank for all the characters alert is just "Character typed: ".

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
Got it.

function copyTextBoxes(evt) {
// evt = window.event;
var groupNameTxt = document.getElementById('groupName');
var fnameTxt = document.getElementById('fname');
groupNameTxt.value=fnameTxt.value + " Users";

<form name="addLDAPApplicationGroup" action="demo_form.asp">
<input type="text" id="groupName" name="groupName" disabled value="disabled">

<input type="text" id="fname" name="fname" onKeyUp="copyTextBoxes(this)" onmouseup="copyTextBoxes(this)" onmouseover="copyTextBoxes(this)">

<input type="button" value="Submit">

I agree. Here's the link:
subject: Typing in two text boxes
Similar Threads
JS code not working.
How to get back in old window from a new window
Is onSubmit() mandatory to write when SimpleFormController is used?
How to remove Textbox Element using DOM in HTML
translate from English to Hindi