Actually "this" does follow you around everywhere, but it's more like
an often changing stray dog than a pet dog.
On Aug 22, 1:24 am, Audrey A Lee wrote:
> I can't expect it to follow me around like a pet dog.
Yep,
I read
http://docs.jquery.com/Attributes
It did not help.
$(this).attr('href')
is easy to understand.
What I did not understand was that "this" had evaporated.
Once I put "this" in my click() call and then picked it up in tellme
(object), I could see "this" in my debugger
and everything f
This was a big help.
Thanks!
-Audrey
On Aug 21, 3:57 pm, James wrote:
> You'd have to pass the reference of the clicked object to tellme(),
> otherwise it has no access to anything from where it's called.
>
> $("a.someLinks").click(function(event){
> tellme(this);
>
> });
>
> function tel
Also, if tellme() is the only thing you're calling in the click
callback, and you don't need to pass any parameters to tellme(), you
could also do it like this:
$("a.someLinks").click(tellme);
function tellme() {
alert(this.href);
}
On Aug 21, 12:53 pm, Audrey A Lee wrote:
> jQuery People
$(this).attr('href')
http://docs.jquery.com/Attributes
On Fri, Aug 21, 2009 at 3:53 PM, Audrey A Lee wrote:
>
> jQuery People,
>
> Suppose I have this syntax:
>
> $("a.someLinks").click(function(event){tellme();});
>
> I want tellme() to handle the value of href of the clicked link.
>
> What syn
Oops, small typo:
function tellme(obj) {
alert(obj.href);
}
On Aug 21, 12:57 pm, James wrote:
> You'd have to pass the reference of the clicked object to tellme(),
> otherwise it has no access to anything from where it's called.
>
> $("a.someLinks").click(function(event){
> tellme(this)
You'd have to pass the reference of the clicked object to tellme(),
otherwise it has no access to anything from where it's called.
$("a.someLinks").click(function(event){
tellme(this);
});
function tellme(obj) {
alert(this.href);
}
On Aug 21, 12:53 pm, Audrey A Lee wrote:
> jQuery Peo
7 matches
Mail list logo