javascript - onkeyup event not working in textarea -
i have basic input/output structure in html:
<textarea id="input" onkeyup="sendcode()"> hello world! </textarea> <div id="output"></div> and have js function should pass input output:
var input = document.getelementbyid("input"); var output = document.getelementbyid("output"); function sendcode(){ output.innerhtml = input.innerhtml; } the sendcode() function works when call manually, seems onkeyup event not firing in textarea.
here jsfiddle: http://jsfiddle.net/mudroljub/y5a2n8ab/
any help?
update: jsfiddle updated , working now.
use value since it's not content text value property
var input = document.getelementbyid("input"); var output = document.getelementbyid("output"); function sendcode(){ output.innerhtml = input.value; } and working demo here
Comments
Post a Comment