I can use this to set a text area (selectedtext) value in a form (submitquestion) if Firefox, but it fails in IE.
document.submitquestion.selectedtext.value = txt;
I can use this to set a text area (selectedtext) value in a form (submitquestion) if Firefox, but it fails in IE.
document.submitquestion.selectedtext.value = txt;
This should work:
<textarea id="bla">from</textarea>
<script type="text/javascript">
document.getElementById("bla").value = "test";
</script>
Try this:
document.forms['submitquestion'].elements['selectedtext'].value = txt;
Assuming you have:
<form name='submitquestion'>
<textarea name='selectedtext'></textarea>
</form>
I recommend using JQuery, it works with all browsers.
$('#selectedtext').val('whatever');
You can do this in pure javascript like this
document.getElementById("myTextarea").value = txt;
© 2022 - 2024 — McMap. All rights reserved.