留言板

element index

l ll,修改在8 年前。

element index

Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
how to write analog jquery in AllowUI?


<ul><li>item1</li><li>item2</li><li>item3</li></ul>

$('ul li').click(function(){ alert($(this).index()); });
thumbnail
David H Nebinger,修改在8 年前。

RE: element index

Liferay Legend 帖子: 14915 加入日期: 06-9-2 最近的帖子
Bookmark the following: http://alloyui.com/rosetta-stone/.
l ll,修改在8 年前。

RE: element index

Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
The first thing I looked there. No analogue index()
thumbnail
David H Nebinger,修改在8 年前。

RE: element index

Liferay Legend 帖子: 14915 加入日期: 06-9-2 最近的帖子
I found this on stackexchange, this might get you the same result (adapted for your code):

Y.all("ul li").each(function (node, index) {
    node.on("click", function(em){
        alert("you clicked on "+ index +" link.");
    });
});
l ll,修改在8 年前。

RE: element index

Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
Thanks!