$(this.hash) gives you a jquery object that you can use for anything you want!
before you use it alert(this.hash) to show you exactly what you have.
I've used it before.. I thought it was cute that the # in the name is
the same as the # in the id name!
On 2/15/07, Tim Baxter <[EMAIL PROTECTED]> wrote:
> But that's not what I need. I need to match up the div to the link. I'm
> going to be manipulating it in several ways, not always onclick, but the
> relationship between the two is the important part. Actually, the whole red
> thing is just for testing.
>
> So far, I haven't been able to get $(this.hash) to do anything for me.
>
>
>
> On 2/15/07, Angelo Sozzi <[EMAIL PROTECTED] > wrote:
> >
> > You are thinking too complicated this should do:
> >
> > $(document).ready(function() {
> > $("a.trigger").click(function(){
> > $(this.hash).css({background: "red" });
> > });
> > });
> >
> > Regards
> >
> >
> >
> > [EMAIL PROTECTED] wrote:
> > >
> > > I just know this is a dumb question with a simple answer, but here
> goes...
> > > I have something like:
> > > #div1 Link a
> > > #div2 Link a
> > >
> > > and
> > > <div id="div1"></div>
> > > <div id="div2"></div>
> > >
> > > I need to match the link to it's div, but can't figure out the selector.
> > > Non
> > > working test js is:
> > > $(document).ready(function() {
> > > $("a.trigger").each(function(i) {
> > > targetDiv = $($(this).href);
> > > targetDiv.style.background = "red";
> > > });
> > > });
> > >
> > > So how do I match the link to it's div?
> > >
> > > _______________________________________________
> > > jQuery mailing list
> > > [email protected]
> > > http://jquery.com/discuss/
> > >
> > >
> >
> > --
> > View this message in context:
> http://www.nabble.com/Finding-element-that-matches-anchor-link-tf3234867.html#a8991866
> > Sent from the JQuery mailing list archive at Nabble.com.
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/