我需要在將綁定值綁定到select
期間操作這些值。哪個事件可以傳遞綁定值作爲參數,並返回相同的附加屬性或直接獲取選項並返回並添加屬性?將事件綁定到下拉列表中的事件
這樣的事情,
@Html.DropDownListFor(m => m.UserId, Model.UserList, "Select Name", new { @class = "target", @id = "ddlNames" })
$(".target").xxx(function() {
//Fetch the options here and add a property (selected="selected")
});
任何想法?
這應該這樣做。 – iamCR
絕對按照我的工作片段。 –