Well, your referencing an id of #orderedlist, which i do see assigned in your 
html. $("#orderedlist li").
 
I also don't see any purpose of handling that type of simple functionality with 
jquery.
 
Just use css to handle the hover and save your self from having 5 lines of 
unnessary code.
 
I believe one of the most important aspects of development, is of knowing when, 
where, and how to handle and separate certain aspects of design 
and functionality.
 
 
 
http://2whoa.com/dominate/
 


--- On Sun, 9/14/08, michbeck <[EMAIL PROTECTED]> wrote:

From: michbeck <[EMAIL PROTECTED]>
Subject: [jQuery] get colored list-items while hovering?
To: "jQuery (English)" <jquery-en@googlegroups.com>
Date: Sunday, September 14, 2008, 10:16 AM

hello folks,

sorry, i'm very new to jquery and i'm trying to run a pretty simple
test, but it doesn't work :-/
could anybody give me a hint what's wrong?

i want my li-itmes get colored grren while hovering, the alert-window
after clicking a link works fine.

thanx in advance!

----
<html>
 <head>
   <script type="text/javascript"
src="jquery.js"></script>
   <script type="text/javascript">
         $(document).ready(function() {

           // get a-Tags from DOM and do click-event
           $("a").click(function() {
             alert("thx!");
           });

           // get li-Tags from DOM and define class
           $("#orderedlist li").hover(function() {
             $(this).addClass("green");
           },function(){
             $(this).removeClass("green");
           });

         });

   </script>

   <style type="text/css">
                .green { background-color:green; color:blue;}
   </style>

 </head>
 <body>

        <a href="http://jquery.com/";>Link 1</a><br />
        <a href="http://www.test.com/";>Link 2</a>
        <hr>

        <ol>
                <li>Point 1</li>
                <li>Point 2</li>
                <li>Point 3</li>
        </ol>
        <hr>
        <ol>
                <li>Point 1</li>
                <li>Point 2</li>
                <li>Point 3</li>
        </ol>

 </body>
 </html>



      

Reply via email to