Skip to main content
Nintex Community Menu Bar
Question

close a popup with javascript

  • July 9, 2024
  • 7 replies
  • 698 views

Forum|alt.badge.img+9

I asked this the other day and Zack wrote a snippet for closing 1 popup. Now I need to close 2.
I tried modifying the snippet, but can’t get it to work
 close_popup = function(){         var popup_array = skuid.$(‘.ui-dialog-content’);
         for (i = 0; i < popup_array.length; i++){
        popup_array[i].dialog(‘destroy’);
        popup_array[i].remove();}
    };
i do get the array, which appears to have dom elements in it, but i get “undefined is not a function” when i try and call destroy
do i have to somehow transform the array item into something jquery can call ‘dialog’ on ?

This topic has been closed for replies.

7 replies

Forum|alt.badge.img+13

This will close, destroy, and remove all open popups on the screen:

skuid.$(‘.ui-dialog-content’).dialog(‘close’);


Forum|alt.badge.img+9
  • Author
  • July 9, 2024

Thanks Zach,
I was  trying to hard, I guess.
Ken


Forum|alt.badge.img+8

Is there an easy way to have it close the window as well?


Forum|alt.badge.img+13

Forum|alt.badge.img+8

#mustlearnjavascript

#Ihatedumbquestions


Forum|alt.badge.img+9

Is there a way to close two out of three popups on a page?

I tried this but it didn’t work:

var pop1 = skuid.$('.ui-dialog-content')[1]; var pop2 = skuid.$('.ui-dialog-content')[2];<br>pop1.dialog('close');<br>pop2.dialog('close');&nbsp;

Forum|alt.badge.img+9

Figured out a solutions. Not sure if its the best way:

https://api.jqueryui.com/dialog/ helped a lot.

$.each(skuid.$('.ui-dialog-content'), function(i, row){&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; if(i==2 || i==1){<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; var UIiD = "#"+this.id;<br>&nbsp; &nbsp; &nbsp; &nbsp; skuid.$(UIiD).dialog('close');<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp;<br>});