0

There are many similar topics in stackoverflow about this question, but it does not work for me.

I tried with Google Drive API tutorial at:

https://developers.google.com/drive/realtime/realtime-quickstart#optional_view_a_quickstart_video

Now, I want to autotyping in textbox "Editor 1" and the textbox "Editor 2" will update.

I tried with:

document.getElementById("editor1").value = "ABC";

then the text changed, but the event does not recognized by Google Drive API, and the text of "Editor 2" does not change.

Any suggestion is welcome.

Thank you very much

mommomonthewind
  • 4,390
  • 11
  • 46
  • 74

3 Answers3

4

The answer is there: Trigger a keypress/keydown/keyup event in JS/jQuery?

I dont have reputation to ad this as comment

Community
  • 1
  • 1
0

try jquery event i.e:

$("#editor1").keypress(function(){
    $("#editor2").val($(this).val());    // now you get the value of editor 1 in editor2
});
0

Try using this :

HTML:

Input 1: <input type="text" id="input1" onkeydown="myFunction()"/>
Input 2: <input type="text" id="input2"/>

JS:

function myFunction()
{
var x = document.getElementById("input1");
var y = document.getElementById("input2");
y.value=x.value;
}    

And here's the Demo.

cнŝdk
  • 31,391
  • 7
  • 56
  • 78