jquery Mobile popup dialog dismissible on options doesn't work

javascript, jquery-mobile

Solution

Update

In order to open the `popup` and change the value of `dismissible` at the same time, add `data-dismissible=""` with no value/blank to the `popup` markup, then you can change it to either `true` or `false`.

Markup

<div data-role="popup" id="popupBasic" data-dismissible="">
 <p>To close me, hit the button below.
 <p> <a href="#" data-role="button" data-rel="back">close</a>
</div>

JQM

$(document).on('click', '#openpopup', function () {
 $('#popupBasic').popup('open', { dismissible: false });
});

You have two options:

1) To define the value of `data-dismissible` in the `popup` markup.

Markup

<div data-role="popup" id="popupBasic" data-dismissible="false">
 <p>To close me, hit the button below.<p>
 <a href="#" data-role="button" data-rel="back">close</a>
</div>

<a href="#" data-role="button" id="openpopup">click me</a> // open it

JQM

$(document).on('click', '#openpopup', function() {
 $('#popupBasic').popup("open");
});

2) Change `dismissible` value before/after opening it.

Markup

<div data-role="popup" id="popupBasic">
 <p>To close me, hit the button below.<p>
 <a href="#" data-role="button" data-rel="back">close</a>
</div>

<a href="#" data-role="button" id="openpopup">click me</a> // open it

JQM

$(document).on('click', '#openpopup', function() {
 $('#popupBasic').popup("open");
 $('#popupBasic').popup({ dismissible: false });
});

Live example - updated

Problem

jquerymobile 1.30 + jquery 1.91 ``` //dismissible doesn't apply $("#popupDialogCategoriesButton").click(function (e) { $("#popupDialogCategories").popup("open", { dismissible: false }) }); //dismissible does apply , set it after open $("#popupDialogCategoriesButton").click(function (e) { $("#popupDialogCategories").popup('open'); $("#popupDialogCategories").popup("option", "dismissible", false); }); ```

Original source