Share the post "JQuery hide() Messes Up Applet State, Gives IllegalStateException"
Seems like an applet that is inside a DOM container and getting hidden by calling JQuery’s hide() method messes up the applet’s state.
In my case, I got an IllegalStateException and in some cases forced it to restart the applet which in turned messed up the operation that my code is doing.
I used the deployJava.js script to deploy the applet and enable me to call applet methods from Javascript.
So rather than using hide, user Danny Coulombe of StackOverflow gave a very workable solution. Using CSS, you can use JQuery to add the class attribute to hide or show the applet. See code.
|
1 2 3 4 |
.hide { position: absolute; left: -10000px; } |
To hide, call $(‘myapplet’).addClass(‘hide’).
To show, call $(‘myapplet’).removeClass(‘hide’).
A very useful solution to preserve your applet state in case you wish to hide it from the user’s view and show it later on using the same instance.