Here’s what I’m trying to run:
<script type="text/javascript">
$("input[@name='paymenttype']").change(function(){
if ($("input[@name='paymenttype']:checked").val() == 'deposit') {
//Display deposit form.
}
else if ($("input[@name='paymenttype']:checked").val() == 'creditcard') {
// Display credit card form.
}
});
</script>
However, the Razor view engine is catching my @ symbol.
Is there some way to tell it to ignore that specific instance of the @ symbol?
You shouldn’t be using
@in those selectors.This syntax has been deprecated since jQuery 1.2, and it was removed in 1.3.
To answer your questions, you can output a literal
@by writing@@, or you can move that code to an external (non-Razor).jsfile.