Reputation: 1
I have jQuery code in a JSP:
${'#userid').val('admin')
The app server is interpreting the jQuery code as JSP:
The function val must be used with a prefix when a default namespace is not specified
How do I "escape" the JavaScript?
Upvotes: 0
Views: 770
Reputation: 597036
There is absolutely no problem in using javascript in jsp pages.
Your example does not work because it is not valid jQuery - instead it starts like an EL expression. Your first bracket should not be curly:
$('#userid').val('admin')
Upvotes: 5