jquer的from提交

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>

<body>
    <form action="">
        姓名:<input name="user" type="text">
        密码:<input name="pass" type="password">
        <button type="submit">提交</button>
    </form>
</body>
<script>
    $('form').submit(function () {
        console.log($('form').serialize());
        return false;
    })
</script>

</html>

猜你喜欢

转载自blog.csdn.net/qq_38932474/article/details/107381004