JS获取同胞元素

'clickfu':function (to) {

//回调函数,to为点击对象

to.setAttribute("class","cur");

var siblings = to.parentNode.childNodes;

for (var i = 0; i < siblings.length; i++){

if (siblings[i].nodeType == 1 && siblings[i] != to){

siblings[i].className = '';

}

}

}

你可能感兴趣的:(JS获取同胞元素)