Get the ID of node using YUI 3.3
There is one accordian in YUI and I want element id of the element which height is more than 0px.
Here is some part of code
<div class="accordian">
<div id="item1" class="yui3-widget-bd"></div>
<div id="item2" class="yui3-widget-bd"></div>
</div>
and javaScript
YUI().use("node", function(Y) {
Y.all('.yui3-widget-bd').each(function(node) {
accHeight = node.get("offsetHeight");
alert("this is height " + accHeight);
if (accHeight > 0) {
alert("insid开发者_JAVA百科e if");
alert(node.get("ID"));
}
else {
alert("in else condition");
}
});
})
Instead of getting "Item1 " alert. I am getting "undefined"
Working example on JSFiddle
It is case sensitive. id
should be lower case.
node.get("id")
精彩评论