popup弹出框

24 篇文章 0 订阅

    h5 触发点

<tr>
              <td>性别
                 <a id="my_sex" href="#myPopupDialog" data-rel="popup"  data-position-to="window" class="my_data_input" data-transition="fade" type="text" data-role="none"  >请输入性别</a>
              </td>
            </tr>
            <tr>



h5弹出:


            <div data-role="popup" id="myPopupDialog" data-theme="a" data-dismissible="false" data-overlay-theme="b" class="ui-corner-all">
                <div data-role="header">
                  <h1>您的性别</h1>
                </div>
                      <div data-role="main" class="ui-content"   >
                       <!--  <h2>欢迎访问弹窗对话框!</h2> -->
                       <!--  <p>jQuery Mobile 非常有意思!</p> -->
                        <!-- <a href="#" 
                       class="ui-btn ui-corner-all ui-shadow   ui-btn-inline ui-btn-b ui-icon-back ui-btn-icon-left" data-rel="back">
                      返回</a> -->
                          <fieldset data-role="controlgroup" data-type="vertical">
                            <legend>单击选择:</legend>
                              <label for="male">男</label>
                              <input type="radio" name="gender" id="male" value="male">
                              <label for="female">女</label>
                              <input type="radio" name="gender" id="female" value="female"> 
                          </fieldset>
                      </div>
                <a href="#" data-rel="back"  class="ui-btn ui-corner-all  ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">关闭</a>
            </div>

js监听


$("#male").attr("checked","checked");//默认是男的
   $( "#myPopupDialog" ).on({//监听性别myPopupDialog生命周期
        popupbeforeposition: function() {//显示
            console.log("myPopupDialog-popupbeforeposition");
        },
        popupafterclose: function() {//消失
          console.log("myPopupDialog-popupafterclose");
           genderSelected = $("input[name='gender']:checked").val();
           var textGender="男";
                if( genderSelected=="male"){
                   console.log("isMale-"+true);
                   textGender="男";
                }else{
                  console.log("isMale-"+false);
                   textGender="女";
                }
         $("#my_sex").text(textGender).css("color","#000000");//性别选择后输入框显示 并且颜色为灰黑色
        }
    });


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值