[jQuery] Finding element that matches anchor link

2007-02-15 Thread Tim Baxter
I just know this is a dumb question with a simple answer, but here goes... I have something like: a href=#div1 class=triggerLink a/a a href=#div2 class=triggerLink a/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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Ⓙⓐⓚⓔ
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: a href=#div1 class=triggerLink a/a a href=#div2 class=triggerLink a/a and div id=div1/div div id=div2/div I

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Tim Baxter
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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Angelo Sozzi
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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Ⓙⓐⓚⓔ
$(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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Klaus Hartl
Tim Baxter schrieb: 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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Tim Baxter
Thanks.. it just took a while to see how it fits. On 2/15/07, Klaus Hartl [EMAIL PROTECTED] wrote: Tim Baxter schrieb: 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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Ⓙⓐⓚⓔ
$(document).ready(function() { $(a.trigger).click(function(){ $(this.hash).css({background: red }) // right here the chain can keep on chaining and no local or (GLOBAL) variables! }); }); On 2/15/07, Klaus Hartl

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Klaus Hartl
Ⓙⓐⓚⓔ schrieb: $(document).ready(function() { $(a.trigger).click(function(){ $(this.hash).css({background: red }) // right here the chain can keep on chaining and no local or (GLOBAL) variables! }); }); Yes,

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Danny Wachsstock
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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Aaron Heimlich
On 2/15/07, Aaron Heimlich [EMAIL PROTECTED] wrote: On 2/15/07, Danny Wachsstock [EMAIL PROTECTED] wrote: 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. That's because it's not an

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Aaron Heimlich
On 2/15/07, Danny Wachsstock [EMAIL PROTECTED] wrote: 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. That's because it's not an attribute, it's a property of the HTML DOM object for a

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Ⓙⓐⓚⓔ
Mozilla agrees with Aaron.. http://developer.mozilla.org/en/docs/DOM:window.location Properties All of the following properties are strings. You can read them to get information about the current URL or set them to navigate to another URL. The Example column contains the values of the

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Danny Wachsstock
oops. It should be $(/#.+$/.exec(this.href)[0]); Danny Danny Wachsstock wrote: 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

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Aaron Heimlich
On 2/15/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Mozilla agrees with Aaron.. http://developer.mozilla.org/en/docs/DOM:window.location That's talking about the window.location object. I was talking about the DOM element for a's (HTMLAnchorElement). There appears to be no official standard that

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Tim Baxter
Guys, they're just anchor links: http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#anchors-with-id On 2/15/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Mozilla agrees with Aaron.. http://developer.mozilla.org/en/docs/DOM:window.location Properties All of the following properties are

Re: [jQuery] Finding element that matches anchor link

2007-02-15 Thread Aaron Heimlich
On 2/15/07, Klaus Hartl [EMAIL PROTECTED] wrote: This property is DOM Level 0, which is implemented by literally any browser (from Netscape 2 onwards by all browsers, http://www.quirksmode.org/js/dom0.html), just like document.forms and these things. So that explains it, then. Thanks, Klaus!