opinionatedmedic
New Member
I'm using \[code\]$('form-selector').get(0).reset()\[/code\] to reset form values to their original page load state.After editing, the form will submit via \[code\]$.ajax()\[/code\] and I'll have new "default" values on our server. The form element will still exist in the dom, and the user can submit again to update. I'd like the "default" (reset values) to reflect what's on our server (ignoring any other external updates). Is it possible to update the underlying values that \[code\]form.reset()\[/code\] will change each form element to without a page refresh?Cross-browser support would be nice, but since this is an internal app, Google Chrome only is sufficient.HTML\[code\]<form> <input type="text" value="http://stackoverflow.com/questions/13754071/foo" name="bar" /> <input type="submit" value="http://stackoverflow.com/questions/13754071/Submit" /> <Input type="reset" value="http://stackoverflow.com/questions/13754071/Reset" /></form>\[/code\]JAVASCRIPT\[code\]$(function(){ $('form').submit(function() { // Omitting code that sends form values to the server // TODO: update underlying form.reset() // values to what's currently in each // form element. return false; });});\[/code\]