views:

68

answers:

2

Javascripters, a 'puzzle': Using a simple HTML form, make two textboxes. Whatever text you type (say, some random string of characters like asdfasdf ) into textbox #1 is IMMEDIATELY displayed, on the fly, without pressing any button or changing focus, into textbox #2. Can it be done using getElementByID?

+1  A: 

If immediately is the most important word, you must handle the keypress event, then add the pressed key to your storage string. Then place that string into your result div or textarea.

Bick
+2  A: 

Simply:

<textarea id="text1" onkeyup="document.getElementById('text2').value = this.value"></textarea>
<textarea id="text2" onkeyup="document.getElementById('text1').value = this.value"></textarea>
BenWells