Check if Popup is open then close it
I am using Jquery Mobile for my Applicaion .
In my page i have 5 popups as shown above
- <div data-role="popup" id="one" class="ui-content" data-theme="a">
- </div>
-
- <div data-role="popup" id="two" class="ui-content" data-theme="a">
- </div>
-
- <div data-role="popup" id="three" class="ui-content" data-theme="a">
- </div>
My requirement is that ,
On click of the device backup button , how can i check if any of the popup is open , close it
I have tried this code , but its not working
- function homedeliverypagebackfunctionality() {
-
- if($("#one").hasClass("ui-popup-active"))
- {
- $( "#one" ).popup( "close" );
- }
-
- if($("#two").hasClass("ui-popup-active"))
- {
- $( "#two" ).popup( "close" );
- }
-
- if($("#three").hasClass("ui-popup-active"))
- {
- $( "#three" ).popup( "close" );
- }
-
-
- }