I am trying to assign a razor variable with the contents of a combo box on my form from within a javascript function. Like so:
<script type ="text/javascript">
<!--
function SomeFunction() {
var hours = document.getElementById("Hours");
var task = document.getElementById("TaskType_ID");
@{
var tsk = @:task.value;
}
@{
<text>
hours.value = '@ViewBag.TaskTypes.GetHours(tsk)';
</text>
}
return true;
}
//-->
</script>
the line (and every other variation I've tried)
var tsk = @:task.value;
results in an error.