Zakki Alawi
Zakki Alawi

Reputation: 83

Open popup page using jquery click()

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 ?

Upvotes: 4

Views: 13938

Answers (1)

Omar
Omar

Reputation: 31732

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');
});

Upvotes: 5

Related Questions