jquery - javascript issue on reloading data from div element -
i have
<div id=x><textarea>data</textarea></div>
data populated via ajax request. if change text (by typing in textarea) , if fire event on keypress/change old data value (alert displays old data)...
$(function(){ $('#x').change(function(event){ xx=$('#x').html(); alert(xx); }) });
keydown
, keypress
fire before input's value updated. try keyup
instead. also, change
event fires once element loses focus, , @jinggoy mentioned, should attached inputs.
jsbin: http://jsbin.com/vitomatocu/1/edit?html,js,console,output
Comments
Post a Comment