Reputation:
How can I alert JSP tag inside javascript?? Is it possible? I want to alert
<%=%>
I tried:
alert("<%=%>")
but it is not working.
Upvotes: 1
Views: 454
Reputation: 28538
No need escape the character:
alert("<%=%>")
Check console for errors, which blocking it to alert.
Upvotes: 1
Reputation: 48
<%
String a = "123";
%>
var v = '<%=a%>';
alert(v);
try it like this;
Upvotes: 0
Reputation: 11117
You can try that:
<script language="javascript">
function one()
{
alert("var: "+<%= var %> );
}
</script>
Upvotes: 0
Reputation: 19093
Try this:
alert("\<\%=\%\>");
The '\' characters escape the following character to stop them being interpreted as jsp delimiters.
Upvotes: 0