In order for JSP to embed EL variables, JavaScript must go to <script> inside the .jsp file instead of the .js file.
Alternatively, you can also just do a simple line-replacement of the first word or a substring of the first four characters. This way you don't need EL in JavaScript, and you can just put the JS code in your own .js file.
By the way, the logical flow of your entire function makes its own very little meaning. Would you like to check if val() "Hide" ? Don't you want to use "Show" in the name of one of two conditions?
source share