Possible Duplicate:
Escape @ character in razor view engine
how can i use '@' symbol in my script code in the MVC page (razor engine)
write a code like this :
<script>
var a = "this is a test text with @ symbol";
alert(a);
</script>
You can escape by use of two ampersat symbols: @@
.
var a = "this is a test text with @@ symbol";
As an aside, though I recently learned and think those coming across this question might also find it useful: you can do comments with a combination of ampersat signs and asterisks:
@*this would comment out some code, or just allow for comments in general*@
@@
should work to escape the character
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With