Inline JS within Popup

I have this inline JS code which I use for drag and drop functionality within table. It works fine when the table is on the main page but now I am trying to execute this within a popup. Any tips?

(function(skuid){var $ = skuid.$;
var component = skuid.$C(‘sk-3MxwBj-240’),
   listContents = component && component.element.find(’.nx-list-contents’);
   placeholder: “ui-state-highlight”,
   stop: function( event, ui ) {
       var data =‘object’),
           model = data.list.model,
           movedRow = data.row,
           target = $(;
           var row =  $(tr).data(‘object’).row,
               order = row.Order__c;
          if (index + 1 !== order) {

Hi Danny. Does the code above reference a unique ID for the table component? “sk-3MxwBj-240” may need to be changed if it should refer to a different component in the popup.

yes that is referencing the new table within the popup.  I believe the issue is that this JS is inline which means it executes after the main pages loads where as I need this to execute after the popup loads.

Okay. In that case, you might need to set up a second (matching) JS inline Snippet for the popup, and trigger that as one of the actions that happens when the popup is opened. Is the popup showing a page include, or is it all part of one page?

I tried that as well. I have a button which when clicked opens the popup.  The action after that renders a snippet.  That did not seem to work either. Let me know if you were referring to a different type of action.

That’s along the lines of what I had imagined. You may also need to remove or replace the line


since the pageload event doesn’t happen when the button is clicked.

Ok I will try this thanks

That worked thanks!