I would know if this is a bug… When I alert html content from #test, I get :
<input name="sum" value="" type="text">
whereas it was set to 55 just before the alert, and I can view it on the brower.
Can you tell me why ? 🙂
<div id="test">
<input type="text" name="sum" value="">
</div>
<script language="javascript">
$(document).ready(function() {
$("#test").find("input[name='sum']").val(55);
alert($("#test").html());
});
</script>
This is not a bug. The value of #test is not part of the HTML content of the input — it was set after the element was inserted into the DOM — and thus the html() function doesn’t return it.