yui2到jQuery DOM获取变量Code Translation的值

时间:2014-04-24 06:36:32

标签: javascript jquery dom yui yui2

就像标题所说我试图在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");

有什么建议吗?^^

0 个答案:

没有答案