The below snippet illustrates the problem, when the user adds some input to the second text input field, the alert does not include the new input.
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#click').live('click',function(){ alert($('#test').html())})
})
</script>
<div id="test">
<input type="text" value="test"/>
<input type="text" value=""/>
</div>
<a id="click">clickme</a>
for convenience: http://jsfiddle.net/CqPkP/
The
.html()function will not get the updated DOM attributes. You have to manually get the updated attributes.. check below demo,DEMO: http://jsfiddle.net/skram/CqPkP/2/
Full Code:
Ref: jQuery html() in Firefox (uses .innerHTML) ignores DOM changes