Tag: selecteditem

选定的列表框项目未定义

$(function () { $(“select[name=’CusList’]”).removeAttr(‘multiple’); $(“select[name=’CusList’]”).attr(‘size’, ‘8’); $(“select[name=’CusList’]”).find(‘option:first’).attr(‘selected’, ‘selected’); //fx(); }); function fx() { var resid = $(“select[name=’resourcename’]”).val(); alert(resid); } @Html.ListBox(“CusList”, ((List)ViewData[“Customer”]), new { @class = “k-list”}) 我试图从pageload(在控制器上)和函数()内部调用fx() ()。 两者都警告为undefined $(document).ready (function(){ $(‘#CusList’).bind(“click”, function () { debugger; var resid = document.getElementById(‘CusList’); var id = resid.options[resid.selectedIndex].value; alert(id); //this gives me id correcly, so ly listbox is correct […]

jQuery,克隆选择,禁用以前选择的选项

我正在这个网站上工作,用户可以在其中创建自己的捆绑包。 基本上他们有一个课程列表,他们可以选择5并创建一个包。 我正在采取的方法是所有课程的下拉列表,然后点击克隆。 我想要做的是禁用下一个克隆列表中以前选择的任何项目。 这可能吗? 这是我的代码: http : //jsfiddle.net/Y4fLM/ 非常感谢!