开发者

Display form values prior to submit for debugging

开发者 https://www.devze.com 2023-04-11 14:47 出处:网络
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 sub

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号