Greasemonkey (JavaScript) textarea question -


I have written a basic Greasemonkey script that passes an output like this:

 < Code> var obj = document.getElementById ("comment"). InnerHTML = "\ n" + "Note:" + "\ n" + "\ n" + output_string;  

It works like a magic, if you change the value from the source, then it will update the texture. However, as soon as you write anything inside Textera and select the value, what is written inside the textera will not be written on it. Why do you have to completely refresh the page to use the function again?

texture 's value As soon as you have something set in it, it overrides any internal HTML value.

You should use the value attribute to set the content of input elements such as textarea .

Try it instead:

  var obj = document.getElementById ("comment"). Value = "\ n" + "Note:" + "\ n" + "\ N" + Output_String;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -