Rerender Okta Custom Login Widget

I am rendering the custom login widget with this code:

    signIn.renderEl({
          el: '#widget-container'
        }, function success(res) {
          if (res.status === 'SUCCESS') {
        });

The widget renders successfully however I need to switch between two custom widgets since I have two different Okta orgs that I need to dynamically log in to.
In order to rerender the log in widget with a different signIn variable I recursively delete all elements in the widget-container id:

    var myNode = document.getElementById("widget-container");
          while (myNode.firstChild) {
            myNode.removeChild(myNode.firstChild);
          }

However when I try to render the widget again using the same code as the first one only one element gets created and nothing else. How can I rerender the whole thing?

Have you tried remove?

Hi Tom, thanks I did not realize there was more to the API. signIn.remove() before rerendering it worked for me.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.