Take innerHTML
of the div
and apply it as value
to the textarea
(demo):
var div = document.getElementById("transcript");
var txt = document.getElementById("usercomment");
txt.value = div.innerHTML;
Or jQuery way:
$("#usercomment").val($("#transcript").html());
Edited
If final_transcript
is the recognition result string you want to append, here:
// update the web page if (final_transcript.length > 0) { $('#transcript').html(final_transcript); }
you should append "final_transcript" to textarea's value:
var txt = $("#usercomment");
txt.val(txt.val() + final_transcript);
Edited 2
Here is your updated fiddle (look on 17 and 18 lines of JavaScript).
You can read what is val()
function does here