a bit clunky! just pass in this! and let checkState do the dirty
work... if it is actually needed!

On 1/13/07, Miles Storey <[EMAIL PROTECTED]> wrote:
>
>
> On 1/14/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> >
> >
> > Is "id" an ID? If so, you could use $('#id.something') and chain
> > whatever methods you want onto it.
>
> The code that sets the event and function call is:
>
> $("#options").find("a").click(function(){
> checkState("#"+this.id)});
>
> If there's a better way to pass an element reference to a function I'd love
> to know, this works but it feels a bit clunky having to append the # like
> that.
>
> > IYou could do something like this:
> >
> >    $(id).removeClass('inactive').addClass('active');
> >
> > and this:
> >
> >    $(id).removeClass('active').addClass('inactive');
> >
> > Your approach will strip the id of any other classes that it might
> > have as well. So, if the element were <div id="foo" class="inactive
> > pretty">, you would be changing it to <div id="foo" class="active">,
> > and you would be losing the "pretty."
> >
> > By using .removeClass() and .addClass() you can be a little more
> > precise.
>
> Thanks, I thought about that, it is probably better practice than the way
> I'm doing it using the attr method.
>
> Cheers
> Miles
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to