I have a value in Jquery. I need to apply that value to a view which has a model.
For example, I need to do assign it to the :
@Html.HiddenFor(model => model.program.programid)
the variable that I am trying to store in model.program.programid is called prog.
I tried:
$('#program_programid').val(prog);
but does not seem to assign it the value.
If your object is a textbox,
val()sets its value:If not, then use
text():