I am invoking JavaScript from a JSP. I am passing a string value from a JSP variable to the JavaScript function. If this string contains a ' (single quote), then the JavaScript fails. eg: When I call the function as follows => (the variable remarks contains a single quote in that string.) onClick='openWin(<%= remarks %> )' Pls. help. Is there any way out that I can get rid of this ???
Ramneek Handa
Ranch Hand
Joined: Nov 10, 2000
Posts: 44
posted
0
use onClick="openWin(<%= remarks %> )" or onClick=openWin("<%= remarks %>" ) instead of onClick='openWin(<%= remarks %> )' and it will work.
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
"bhushans", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements. Thanks.