How can I put javascript code inside if block.
@{
#if DEBUG
$("#User").val("JDoe");
$("#Password").val("secrect");
#endif
}
When I try above code I get this compiler error:
Compiler Error Message: CS1056: Unexpected character '$'
And if I change $ to jQuery:
Compiler Error Message: CS0103: The name 'jQuery' does not exist in the current context
In my opinion it's a bug in Razor parser. How can I workaround that?
@{#if DEBUG}
$("#User").val("JDoe");
$("#Password").val("secrect");
@{#endif}
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