Assign value to EditorFor using javascript

Hits

New Member
I have this code in my view :\[code\] <div class="drop-down-list"> <%: Html.EditorFor(model => model.StageId,new { id="hiddenStageID"}) %> <%: Html.ValidationMessageFor(model => model.StageId) %> </div>\[/code\]And this is my javascript code to set value of EditorFor. But it does not work :\[code\]<script> var e = document.getElementById("stageTwoView"); var listIndex = e.selectedIndex; var stageIdVal = list[listIndex].valueOf(); document.getElementById('hiddenStageID').value = http://stackoverflow.com/questions/15886392/stageIdVal;</script>\[/code\]for example stageIdVal get this value : "1003". But the last line does not work! Why?
 
Back
Top