I’m trying to display a Popup using jQuery Mobile, but I have a problem with the styling of the popup.
The HTML markup looks like this:
<div data-role="popup" id="confirmDialog" data-overlay-theme="a" data-theme="c" style="max-width:400px;" class="ui-corner-all">
<div data-role="header" data-theme="a" class="ui-corner-top">
<h1>Delete Page?</h1>
</div>
<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
<h3 class="ui-title">Are you sure you want to delete this page?</h3>
<p>This action cannot be undone.</p>
<a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a>
<a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Delete</a>
</div>
</div>
(BTW, this code is copied from the jQuery Mobile site).
When I open the popup using the .popup(‘open’) method, the header (Delete Page?) and the buttons are not styled. The header appears as regular text, and the buttons appear as regular links.
What can cause this behavior?
Thanks!
You are probably having an error in your HTML.
Here’s a working example from your code: http://jsfiddle.net/Gajotres/EtDZc/
and this one:
when working with jQuery 1.9 or higher you must use function on, live is deprecated and no longer exist.
You were also probably using document ready for event binding. It should not be used with jQuery Mobile, instead use page events.