I can't see that you will be able to do what you are trying to do by pure front end manipulations, you will probably need to make changes in the script.
What are you trying to accomplish? Maybe it is possible to solve your business need by another approach?