首页 > Web开发 > 详细

jquery获取表单中的数据

时间:2019-12-01 09:52:18      阅读:62      评论:0      收藏:0      [点我收藏+]
????????? ?<form>

????????????? ? <input name="username" type="text"/>

????????????? ? <input name="password" type="password"/>

????????????? ? <input id="submitButton" type="button" value="submit">

????????????</form>

?????????????$("#submitButton").click(function(){
????????????????????var data = {};
    ? ? ????????var t = $('form').serializeArray();
    ? ? ????????$.each(t, function() {
    ? ? ??????? ?????data?[this.name] = this.value;
    ? ? ????????});
    ? ? ????????alert(JSON.stringify(data));
????????????});

jquery获取表单中的数据

原文:https://www.cnblogs.com/jichi/p/11965106.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!