I am using jQuery to read data in a HTML page. On that page, I have a <form> element which contains some <input> tags for user to enter their values.
When being initialized, this form has some default values for those <input> elements. When I submit this form, I use the html() method to get the HTML string of current state of this page, but I do not why this result string is still contain old values (default input values), not the new ones.
Is there any way to update or persist the user-entered value to those <input> elements before calling html()? How can I get the string which contain newest value by using jQuery methods?
Thank you so much!
I am using jQuery to read data in a HTML page. On that page,
Share
However, it is strange what you are trying to do, but all you need is to update the value attribute of the form elements. It can be done with the following code (put it in the form
submithandler):DEMO: http://jsfiddle.net/BXha6/