0

I am very new to YUI or YUI2

Here i have a criteria, when there are 10 image tags in my page (""). when i click on any image i need to get it's parent(i.e) anchor href value. when i am trying to do this functionality using the the following YAHOO.util.Event.addListener or YAHOO.util.Event.on, i am able to fire the event only on the first img tag and able to get the value of it's parent anchor href value, till now it is fine.

Here my problem is, from the second image event is not at all firing. How i am able to fire event for all the images.

Thanks in advance.

4

1 回答 1

0

With YUI2, you need to add classes to your elements and use stuff like getElementsByClassName:

http://developer.yahoo.com/yui/examples/dom/getelementsbyclassname.html

With YUI3, you could just use selectors like jQuery.

于 2011-04-11T21:37:23.730 回答