Open popup with jquery click ()

I want to open or show a popup 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 pop-up 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 this is not opening a popup. How to do it?

+4
source share
1 answer

To pop up programmatically, you must call it using .popup('open') . Using any event, for example. focus , click , tap ... etc.

Demo

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

Source: https://habr.com/ru/post/1486457/


All Articles