Display form values prior to submit for debugging
How can I dump all of my form values to an alert box prior to form submit..
I have a simple form like this.. I'd like to see the form values in a开发者_如何学编程n alert or console at the time of submit.. I'm using jQuery and jQueryUI (DIALOG) for the form.. but any approach is fin -
<div id="highValueSurvey" title="Some More Advanced Questions">
<p class="validateTips">All form fields are required.</p>
<form>
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" id="name" value=""/>
<BR>
<label for="email">Email</label>
<input type="text" name="email" id="email" value=""/>
<BR>
<label for="name">Tell us More</label>
<input type="text" name="more" id="more"/>
<BR>
<BR>
<label for="name">We want to know even more!!!!</label>
<input type="textarea" name="evenmore" id="evenmore"/>
<BR>
</fieldset>
</form>
</div>
You have a very good example right here: http://api.jquery.com/serialize/
$('form').submit(function() {
alert($(this).serialize());
return false;
});
console.info($('#highValueSurvey form').serializeArray())
.serializeArray()
精彩评论