I'm using Asp.Net Core and trying to reference the model from inside a script tag:
<div>
<script>
function calcprices() {
@Model.Price = document.getElementById("price").value;
}
</script>
<button onclick="calcprices()">Recalculate</button>
The error showing in console window is:
ReferenceError: calcprices is not defined
If I have a look at the debugger, it shows the particular section is missing the Model reference:
function calcprices() {
= document.getElementById("price").value;
}
So I'm guessing that's why I'm getting an error. Is it not possible to reference a model like this?