【发布时间】:2011-09-22 19:48:47
【问题描述】:
我想将一个参数传递给我的函数。该参数将是一个表示 CSS 类名称的变量。根据选中的复选框,我将设置变量的值(例如,如果选中 CheckBox1,则变量的值将是类名 '.list1')。
下拉列表有大量选项,我想根据它们的“类”选择选项的子集,并使用这些选项填充另一个列表 (fl_listEmpty)。
据我所知,这是我的代码:
function FillDropDownList(parameter) {
$('.fl_list1 [**put class name parameter here**]).each(function (index) {
$(".fl_listEmpty").append($('<option> </option>').val(index).html($(this).text()));
})
}
【问题讨论】: