On Nov 17, 6:02 pm, szuwei <sweit...@hotmail.com> wrote: > Thanks a lot! And no, this is not a homework. I'm just new to JQuery, and > it's a work problem.
Well, if you're just learning, the suggestion above was more clever than pedagogical. I would really suggest that you use something more like http://jsbin.com/olowa (code http://jsbin.com/olowa/edit) This puts the actual formatting in CSS, where it belongs: .special {text-indent: 2em;} .odd {color: red;} And doesn't do any complicated .find()-.end() switching of the jQuery, using instead a simple: $("#myList li:odd").addClass("odd"); $("#myList li:eq(4)").hoverClass("special"); This uses a minor plug-in to jQuery which I use so often I would choose to put it in core if I could: $.fn.hoverClass = function(className) { return this.hover(function() {$(this).addClass(className);}, function() {$(this).removeClass (className);}); } Cheers, -- Scott