@ripple:

'.showlayer' = selector
'#div1' = the thing I want to fade in when you click the selector.
There are lots of divs and one class, '.showlayer' for all of the fade
triggers.

My question was: How do I get jQuery to know which div to fade in, by
looking at the href for the selector that was clicked?

Two good answers provided, both illustrating how to get a target out
of the href attribute.

@David:

Thank you, that helped me understand what Ariel's solution was
doing :))

Cherry.

On Apr 17, 1:44 am, David McFarland <[EMAIL PROTECTED]> wrote:
> On Apr 16, 2008, at 5:25 PM, [EMAIL PROTECTED] wrote:
>
>
>
> > Hello there :)
>
> > I've got a bit stuck. I suspect this is a job for Livequery, but can't
> > understand how to use it (sorry, Ariel).
>
> > With this:
> > $( '.showlayer' ).click( function () {
> >    $( '#div1 ).fadeIn( 750 );
>
> > I'm trying to make each link with a class of 'showlayer' show the div
> > which is named in its href:
> > <a href="#div1" class="showlayer">
>
> $('.showlayer').click( function() {
>    var target = $(this).attr('href');
>    $(target).fadeIn(750);
>
> });

Reply via email to