Skip to content Skip to sidebar Skip to footer

Jqm Popup Is Not Opening

I added a popup to a div-container. Opening the popup doesn't work. This is my container-structure:
<

Solution 1:

page div should be direct parent of popup div. If you place it inside any other div, it won't open, or malfunction.

<divdata-role="page"><divdata-role="popup"id="myPopup"><p>My Popup</p></div><divid="myContent"><divid="template"style="display:none;"></div><uldata-role="list-view"></ul></div>

To open it using HTML

<ahref="#popupID"data-rel="popup">Popup</a>

To open programatically

$("#popupID").popup("open");

You need to delegate click event to dynamically added elements.

$(document).on("click", ".select-button", function () {
  $('#myPopup').popup("open");
});

Demo

Solution 2:

Try this out:- http://jsfiddle.net/adiioo7/rF873/

JS:-

$('#myPopup').popup();    
$('#myPopup').popup("open");

HTML:-

<divdata-role="page"><divid="myContent"><!--div id="myContent" data-role="content/main"> dosn't work either --><divid="template"style="display:none;"></div><uldata-role="list-view"></ul><divdara-role="popup"id="myPopup"><p>My Popup</p></div></div></div>

Issue with your approach is that you cannot call methods on popup prior to initialization.

Post a Comment for "Jqm Popup Is Not Opening"