<style> </style> </head> <body> <!-- 1 serialize()
2 serializeArray()
3 submit()
--> <form method="post"> <input type="text" name="val" value="kobe"> <input type="password" name="pw" value="123"> <input type="checkbox" checked="checked" name="rember"> <input type="submit" value="按钮" name="anniu"> </form>
<script src="../zepto.js"></script> <script src="../touch.js"></script> <script> $(function(){ var result = $('form').serialize() console.log(result); // val=kobe&pw=123&rember=on
result = $('form').serializeArray() // (3) [ {name: "val", value: "kobe"} {name: "pw", value: "123"} {name: "rember", value: "on"}length: 3__proto__: Array(0) console.log(result);
$('form').submit(function(event){ event.preventDefault() alert('1') }) }) </script>
</body> </html>