Open popup page using jquery click()

邮差的信 提交于 2019-12-10 16:16:17

问题


I want to open or show up popup page using java script in input text :

<input class="addpopup" type="text" name="address" id="address"></input>
<script>
    $(".addpopup").click(function () {
        $(this).page('#popupAddfix');
    });
</script>

And popup code :

<div data-role="popup" id="popupAddfix">
  <form>
    <h3>Your Address</h3>
    <label >Address</label>
    <input type="text" name="addfix" id="fix" value=""/>

    <button type="submit" >Save</button>
  </form>
</div>

But it is not opening a popup. How do I make this happen ?


回答1:


To open popup programmatically, you need to call it using .popup('open'). Using any event, e.g. focus, click, tap...etc

Demo

$(document).on('focus', '.addpopup', function() {
 $('#popupAddfix').popup('open');
});


来源:https://stackoverflow.com/questions/17130643/open-popup-page-using-jquery-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!