-1
我有javasctipt可变如何在视图中访问js变量,Html.DropDownList?
var orgCode = "";
$("#orgs").change(function() {
var org = document.getElementById("orgs");
orgCode = org.options[org.selectedIndex].value;
});
我想通过orgCode
我的DropDownList所有的时间,当变量的变化:
@Html.DropDownListFor(model => model.Doctor, new SelectList(_unitOfWork.Doctors.GetByOrganization(orgCode).ToList(), "Code", "Name"), new { id = "docs" })
我orgCode
总是变化的,但我怎么能访问它的DropDownList并每次刷新它变化的变化?
在此先感谢!
?什么是$(“#orgs”)? – Nithesh
请看看这里:http://stackoverflow.com/questions/4160735/mvc-dropdownlist-capturing-change-event-without-attaching-the-event-handler –
Nithesh,$(“#orgs”)是另一个下拉列表,我从 –