• form表单转换为Json数据


    最近对前端js学习有点多,如今想自己动手写点插件,后来发现,我想到的,其他人都想到了。于是做了以下笔记。

    使用插件:

    插件 :https://github.com/marioizquierdo/jquery.serializeJSON  

    调用方式:

     console.log($('form[name="formEdit"]').serializeJSON());
    

    HTML代码:

     1 <div class="box">
     2         <div class="content">
     3            <form name="formEdit" method="post">
     4                <input name="id" value="1" type="text" /><br /> 
     5                <input name="name" value="jeamy" type="text" /><br />
     6                <input name="age" value="28" type="number" /> <br />
     7                <input name="sex2"   type="checkbox" checked="checked" /><br />
     8                <input name="sex1"   type="checkbox" checked="checked" /><br/>
     9                <textarea name="intro" cols="5" >dasdfasd</textarea> <br/>
    10                <select name="city">
    11                    <option value ="1">武汉</option> 
    12                    <option value ="2">北京</option> 
    13                    <option value ="3">纽约</option> 
    14                </select><br/>
    15              <label><input name="Fruit" type="radio" value="1"  checked/>苹果 </label> 
    16 <label><input name="Fruit" type="radio" value="2" />桃子 </label> 
    17 <label><input name="Fruit" type="radio" value="3" />香蕉 </label> 
    18 <label><input name="Fruit" type="radio" value="4" /></label> 
    19 <label><input name="Fruit" type="radio" value="5" />其它 </label> 
    20                <div>
    21                    <input type="button" onclick="getinfo();" value="提交" /> 
    22                </div>
    23            </form>
    24         </div>
    25     </div>
  • 相关阅读:
    LeetCode_21.合并两个有序链表
    LeetCode_70.爬楼梯
    LeetCode_001.两数之和
    LeetCode_509.斐波那契数
    Eclipse(2019-03版本)汉化
    修改Gradle本地仓库
    解决Eclipse导入Gradle项目时在 Building gradle project info 一直卡住
    Eclipse设置字体大小
    @Transactional spring 事务(转载)
    @Transactional spring 事务失效(转载)
  • 原文地址:https://www.cnblogs.com/LearningC/p/8118504.html
Copyright © 2020-2023  润新知