Reputation: 11
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?
Upvotes: 0
Views: 408
Reputation: 11
To solve your issue, instead of document.getElementById
you could use
var model = @Html.Raw(Json.Encode(Model));
Upvotes: 1