标签:input res 内容 type jquer button orm min 序列化
http://www.365mini.com/page/jquery-serializearray.htm http://www.365mini.com/diy.php?f=jquery-serializearray-demo <form name="myForm" action="http://www.365mini.com" method="post"> <input name="uid" type="hidden" value="1" /> <input name="username" type="text" value="张三" /> <input name="password" type="text" value="123456" /> <select name="grade" id="grade"> <option value="1">一年级</option> <option value="2">二年级</option> <option value="3" selected="selected">三年级</option> <option value="4">四年级</option> <option value="5">五年级</option> <option value="6">六年级</option> </select> <input name="sex" type="radio" checked="checked" value="1" />男 <input name="sex" type="radio" value="0" />女 <input name="hobby" type="checkbox" checked="checked" value="1" />游泳 <input name="hobby" type="checkbox" checked="checked" value="2" />跑步 <input name="hobby" type="checkbox" value="3" />羽毛球 <input name="btn" id="btn" type="button" value="点击" /> </form> var formArray = $("form").serializeArray(); /* 以下是序列化后的结果数组formArray的内容: [ { name: "uid", value: "1" }, { name: "username", value: "张三" }, { name: "password", value: "123456" }, { name: "grade", value: "3" }, { name: "sex", value: "1" }, { name: "hobby", value: "1" }, { name: "hobby", value: "2" } ]; */ alert( formArray[0].name + "=" + formArray[0].value ); var result = $(":text, select, :checkbox").serializeArray(); /* 以下是序列化后的结果数组result的内容: [ { name: "username", value: "张三" }, { name: "password", value: "123456" }, { name: "grade", value: "3" }, { name: "hobby", value: "1" }, { name: "hobby", value: "2" } ]; */ alert( result[0].name + "=" + result[0].value );
分享一个 jquery serializeArray()序列化方法
标签:input res 内容 type jquer button orm min 序列化
原文地址:http://www.cnblogs.com/zhujiasheng/p/6241467.html