I'm looking at the HTML specs
(http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#edef-A)
and hash doesn't look like a standard attribute. It seems to work for me in
both IE and FF, but if it's not in the standard, your browser may not
support it. You may be stuck with using the regular expression:
$(/#.+$/.exec(this.href));

(The regular expression takes everything from the # to the end of the href)

Danny


[EMAIL PROTECTED] wrote:
> 
> I'm not following. I tried
> targetDiv = $(this.hash);
> 
> but still didn't get the element.
> 
> On 2/15/07, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
>>
>> almost too simple!
>> $(this.hash)
>>
>> On 2/15/07, Tim Baxter <[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/
>> >
>> >
>>
>>
>> --
>> Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
> 
> _______________________________________________
> 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#a8994638
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to