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

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

WBOY
WBOYOriginal
2016-06-06 20:13:372361browse

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>
<code>

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

回复内容:

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>
<code>

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

它这个开关打开以后,会给这个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>
Statement:
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