I have created an ASP.NET MVC app and would like to do some "stuff" with a value in the textbox before its sent back to the controller.
So I have a textbox in a form:
using (Html.BeginForm("HandleForm","Home")
{
<p>Enter Value<p>
@Html.TextBox("amount")
<input type="submit" value="Submit" />
}
normally i would use something like this in JS:
var value = document.getElementById(ID).value;
So how would I do this with the HTML Helpers? is it possible to give this textbox an id?
var myVar = '@Model.MyVarValue';(you might have to play withHtml.Raw(). If the value is written by the user (i.e. after the page gets rendered), you need JavaScript to get it.