【问题标题】:Jquery mobile popup form not submitting or firing clickJquery移动弹出表单未提交或触发点击
【发布时间】:2016-12-14 11:53:15
【问题描述】:

所以我有一个直接来自 jquery 移动网站的弹出表单,如下所示。然后在我的脚本文件中,我有一个旨在在单击按钮时触发的调用。我不确定为什么会这样。

弹出表单:

  <div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
    <form>
        <div style="padding:10px 20px;">
            <h3>Please sign in</h3>
            <label for="un" class="ui-hidden-accessible">Username:</label>
            <input name="user" id="un" value="" placeholder="username" data-theme="a" type="text">
            <label for="pw" class="ui-hidden-accessible">Password:</label>
            <input name="pass" id="pw" value="" placeholder="password" data-theme="a" type="password">
            <button id="admin_btn" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">Sign in</button>
        </div>
    </form>
  </div>

按钮标签曾经是“提交”类型,但决定将其取出并使其成为通用按钮,我将在其中测试是否通过 ID 单击它。不确定这是否意味着什么。

script.js:

$(document).ready()
{
    $('#admin_btn').click(function(){
        alert("Here");
    });  
}

【问题讨论】:

    标签: jquery forms jquery-mobile click form-submit


    【解决方案1】:

    使用这些代码:

    $(document).ready()
    {
    $(document).on("click","#admin_btn",function(){
        alert("Here");
    });  
    }
    

    您可以在这里查看差异link。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-14
      • 2013-08-04
      • 2013-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多