html - jQuery add text to same textarea multiple times glitch -
i built reply system people can reply other comments clicking reply. when click it, runs function in order put @user @ beginning of comment:
$('#inputfield').focus(); $('#inputfield').text(''); $('#inputfield').append(atowner); the atowner variable passed through when calling function.
this works pretty because can keep clicking reply many different comments , erase , refill <textarea> new @newuser.
my problem if type in <textarea>, erase all, click reply, doesn't work. it's funny because actual html still shows put @user <textarea> can't see on site. , when go ahead , submit comment, submitted without @user.
so basically, why html lying me , why isn't showing when type-and-erase in <textarea> first (works rest of time)?
as input (even thought it's textarea should using val() not append or text code be:
$('#inputfield').focus(); $('#inputfield').val(atowner); and should solve problem, should use val retrive contents well.
this works when page loads , when before user performs action because reads dom populate visible textarea treated input after user begins use such why no longer renders dom inside.
Comments
Post a Comment