0

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?

Jai
  • 74,255
  • 12
  • 74
  • 103

1 Answers1

1

To solve your issue, instead of document.getElementById you could use

var model = @Html.Raw(Json.Encode(Model));
B--rian
  • 5,578
  • 10
  • 38
  • 89