Home > Backend Development > PHP Tutorial > weui这样写表单如何传输数据

weui这样写表单如何传输数据

WBOY
Release: 2016-06-06 20:13:37
Original
2349 people have browsed it

WEUI

<code> <div class="weui_cell weui_cell_switch">
 <div class="weui_cell_hd weui_cell_primary">是否开车</div>
 <div class="weui_cell_ft">
      <input class="weui_switch" type="checkbox" name="isdriver">
</div>
</div></code>
Copy after login
Copy after login
<code>

原本的表单</code>
Copy after login
Copy after login
<code><input type="radio" name="isout" value="0" checked>内勤
<input type="radio" name="isout" value="1">外勤</code>
Copy after login
Copy after login

回复内容:

WEUI

<code> <div class="weui_cell weui_cell_switch">
 <div class="weui_cell_hd weui_cell_primary">是否开车</div>
 <div class="weui_cell_ft">
      <input class="weui_switch" type="checkbox" name="isdriver">
</div>
</div></code>
Copy after login
Copy after login
<code>

原本的表单</code>
Copy after login
Copy after login
<code><input type="radio" name="isout" value="0" checked>内勤
<input type="radio" name="isout" value="1">外勤</code>
Copy after login
Copy after login

它这个开关打开以后,会给这个Input元素加一个checked属性,所以你只要给你获取这个checked属性的值
我的思路大概就是放在form表单中的一个隐藏input元素中一起提交

<code><input name="weui_switch_value" id="weui_switch_value" type="hidden">
<script>
    $(function () {
        $(".weui_switch").bind("click",function(){
            $("#weui_switch_value").val($(".weui_switch").attr("checked"));
            alert($("#weui_switch_value").val());
        })
    })
</script></code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template