html - 加载时更改的默认文本框值

标签 html asp.net-mvc

我已经创建了文本框,在提交时我能够获得 123 个值,这很好。当我在文本框中输入新值 (567) 并提交值时,我能够在 View 中看到更改。但仍然文本框显示 123,而不是 567。

@using (Html.BeginForm())

 <input type ="text" name = "id" value="123" />


   <input type="submit" value="Submit"/> </p>

}

最佳答案

提交成功需要更新textbox的value属性

document.getElementByName("id").value = your_updated_value;

关于html - 加载时更改的默认文本框值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26836590/

相关文章:

c# - 让 ASP.NET MVC 正确转义路由中的#(井号/井号)字符

jquery - HTML5 : How to count the length of the files from the multiple-input field

jquery - 使用视口(viewport)单位的响应式设计中的 CSS 文本溢出

html - li 和 p 水平对齐

asp.net-mvc - 如何在 ASP.NET MVC 中控制局部 View 的条件显示

asp.net-mvc - 自定义助手无法正常工作

c# - 如何在 asp.net mvc 4 的 apicontroller 中使用 session

html - CSS 类覆盖属性行为

HTML 代码中的 PHP 变量

c# - 如何在 Asp.net MVC 中使用 C# 访问 HTML 元素?