There is a scenario where I want to update the Model with which the .cshtml page is binded, using javascript. I do not want to use the document.getElementById.
Can we achieve this using javascript?
There is a scenario where I want to update the Model with which the .cshtml page is binded, using javascript. I do not want to use the document.getElementById.
Can we achieve this using javascript?
To solve your issue, instead of document.getElementById you could use
var model = @Html.Raw(Json.Encode(Model));