Web Analytics Made Easy -
StatCounter Simple MooTools $$ Selector Problem - CodingForum

Announcement

Collapse
No announcement yet.

Simple MooTools $$ Selector Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple MooTools $$ Selector Problem

    Hello, I have a simple HTML as below

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript" src="mootools-core-1.3.2-full-compat.js">
    </script>
    <script type="text/javascript">
    window.addEvent('domready', function(){
    $('listItem').setStyle('color', 'red');
    $('superList').setStyle('border', '1px solid #000000');
    alert($$('.lastItem').getFirst().get('text'));
    });
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <ul id="superList">
    <li>List items</li>
    <li><a href="#">List item link</a></li>
    <li id="listItem">List item with an ID</li>
    <li class="lastItem">Last list item</li>
    </ul>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript" src="mootools-core-1.3.2-full-compat.js">
    </script>
    <script type="text/javascript">
    window.addEvent('domready', function(){
    $('listItem').setStyle('color', 'red');
    $('superList').setStyle('border', '1px solid #000000');
    alert($$('.lastItem').getFirst().get('text'));
    });
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <ul id="superList">
    <li>List items</li>
    <li><a href="#">List item link</a></li>
    <li id="listItem">List item with an ID</li>
    <li class="lastItem">Last list item</li>
    </ul>
    </body>
    </html>


    Simple enough? But the alert() didn't pop up. Can you please let me know why?

    Thanks in advance!
Working...
X