就像标题说的那样,我尝试在 jQuery 中进行此操作(“Groups”是 ComboBox 的 ID):
var groups = YAHOO.util.Dom.get("Groups");
var group = groups[groups.selectedIndex];
var elem_name = YAHOO.util.Dom.get(group.value+"name");
var elem_members = YAHOO.util.Dom.get(group.value+"members");
当然, var 组并不是一个大问题,主要问题是 var elem_name 和 var elem_members
var groups = $("#Groups")[0];
var group = groups[groups.selectedIndex];
//Does of course not work
var elem_name = $(group.val()+"name");
var elem_members = $(group.val()+"members");
使用普通的 javascript 它可以工作,但我想知道我如何在 jQuery 中执行以下操作
var groups = $("#Groups")[0];
var group = groups[groups.selectedIndex];
//normal javascript
var elem_name = document.getElementById(group.value+"name");
var elem_members = document.getElementById(group.value+"members");
有什么建议吗?^^