jquery mobile - Check if Popup is open then close it -


i using jquery mobile applicaion . in page have 5 popups 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 , on click of device backup button , how can check if of popup open , close

i have tried code , 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" ); }   } 

if want close open popup:

$('[data-role="popup"]').popup("close"); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -