0

I am generating textbox in MVC Razor.

Html gets Generated as below

<input class="valid" data-val="true" id="9" name="List[8].Address" onchange="ChangeEvent(this);" type="text" value="InitialValue" aria-describedby="9-error" aria-invalid="false">

If i set textbox value with Jquery as below: $('#9').val("NewValue");

enter image description here

Then it gets updated in the UI correctly as above

But issue as below:

<input class="valid" data-val="true" id="9" name="List[8].Address" onchange="ChangeEvent(this);" type="text" value="InitialValue" aria-describedby="9-error" aria-invalid="false">

If I right click and inspect the textbox it still shows the old value. value="InitialValue

Is there any way to change this except postback?

user2739418
  • 1,623
  • 5
  • 29
  • 51
  • Seems like unrelated to ASP.NET MVC, and a duplicate of this: https://stackoverflow.com/questions/7986026/html-input-is-not-updating-value-attribute-on-change – Loonquawl Sep 29 '17 at 15:08
  • Possible duplicate of [HTML Input is not updating value attribute on change](https://stackoverflow.com/questions/7986026/html-input-is-not-updating-value-attribute-on-change) – Loonquawl Sep 29 '17 at 15:09

0 Answers0