JQuery Mobile Popups – Preventing Close When Clicking Outside

JQuery Mobile is usually a very comprehensive package. Although it is under constant development most of the features are suitable for common uses on release time. Other, more enhanced and unique features, are released afterwards.

JQuery Mobile 1.2.0 introduced the popups feature, definitely one of the most needed in mobile applications. I (and I’m sure many others) actually upgraded to this version solely because of the popups feature.

The first popup I’ve made using JQM was a message popup that redirects the user upon clicking on its only button. What I found out is that clicking outside the popup area closes it, which is totally unacceptable UX-wise.

I found nothing that helps solving it in the documentation and I was sure it was another obvious miss of mine. After posting a question in JQuery Mobile’s GitHub issues forum I went to Stack Overflow, there I got the perfect solution:


These few lines of code will do the work until the JQuery Mobile team will deliver this feature via  an option passed to the popup function.

2 thoughts on “JQuery Mobile Popups – Preventing Close When Clicking Outside

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s