I have a list. And am trying to get the context of the list when the user clicks the text using prototype. But this code doesn't not alert the message. What is the wrong with the code?
The code can be seen here: www.modernarapca.com/test.php
JavaScript:
$$('ul#myList2 li').each(function(elmt) {
elmt.observe('click', function(ev) {
var tab;
tab = elmt.down('a').readAttribute('href');
alert("entered");
});
});
Markup:
<ul id="myList2">
<li>
<a href="javascript:;" class="" >text1</a>
</li>
<li>
<a href="javascript:;" class="" >text2</a>
</li>
<li>
<a href="javascript:;" class="" >text3</a>
</li>
</ul>