javascript - append function not working to textarea after text edited -
javascript - append function not working to textarea after text edited -
append function not appending when textarea text edit . tried pull in current value, append, , set back. not working .
function getserial() { var getvalue = $(serial).val() + ",\n"; var showvalue = "#showserial"; $(showvalue).append(getvalue); }
if utilize val() replace before submitted value . value of text-area added comma al-2, al-3 every single submit .
try using val()
instead of append()
: i've created test fiddle, work you?
function getserial (){ var showvalue = $("#showserial"); var getvalue = $(serial).val()+ ",\n"; if(showvalue.val()){ $(showvalue).val(showvalue.val() + getvalue); }else { $(showvalue).val(getvalue); } }
https://jsfiddle.net/mc5rrkmu/1/
javascript jquery
Comments
Post a Comment