I have a form with a textbox like this:
<html>
<head>
<script type="text/javascript" src="jquery-1.6.2.js"></script>
</head>
<body>
<input type="text" id="myTextBox" />
</body>
</html>
When I type something in myTextBox, the value is available with $("#myTextBox").val()
, but is not represented if i do $("body").html()
. How can I grab the html string and the updated form value too? Thanks!
You can use the .attr()
function.
Example:
$("input").each(function(){
$(this).attr("value", $(this).val());
});
After this you can do the:
$("body").html();
This should work.