How can I set a value to my model using jQuery?
I have an input field (which its id=\"comment\") and I want the text in it to be inserted into @Model.Comment
Far be it from me to disagree with Darin (he's answered half my questions on here!) but will put this up in case the OP or anyone else finds it useful.
By giving an Html attribute to a model value:
@Html.HiddenFor(x => x.Object.Id, new { id = "Id" } )
You can then set the value with Jquery like so
$("#Id").val(5); // or whatever value