最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Open popup page using jquery click() - Stack Overflow

programmeradmin0浏览0评论

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 ?

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 ?

Share Improve this question asked Jun 16, 2013 at 6:02 Zakki AlawiZakki Alawi 831 gold badge1 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

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');
});
发布评论

评论列表(0)

  1. 暂无评论