On Apr 17, 2007, at 2:25 AM, Klaus Hartl wrote:

$(function(){
    var toggle = function() { $(this).parent().toggleClass('on') };
$('fieldset").find('input, select, textarea').focus(toggle).blur (toggle);
});

I'd choose this approach in order to avoid typing the class name "on" in more than one place (which may lead to errors if you want to change that one and forget it somewhere - not here maybe but in larger chunks of code).

To make it even tighter, you could probably change this part:
        $('fieldset").find('input, select, textarea')
to:
        $(':input', 'fieldset')


Cheers,

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




Reply via email to