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
  • 72,925
  • 12
  • 73
  • 99

1 Answers1

1

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

var model = @Html.Raw(Json.Encode(Model));
B--rian
  • 5,011
  • 10
  • 34
  • 73