why is jquery using the href value of a hyperlink in place of the html content here?

Status
Not open for further replies.

ura_soul

New Member
1
2015
0
0
aloha! this is my first post here.. i am wondering if any here can point me to what i am missing in this jquery code.. the code is simple enough, but surprisingly the results are totally different.. so much so that i am wondering if this is a bug with the older version of jquery i am being forced to use here (temporarily) (1.6.4).

all i'm doing is looping through a set of hyperlinks, doing a couple of checks on them and then some further processing.
one of the checks is to make sure that the href value of the link is the same as the text/html content of the link, for which i am using:

if ($(this).attr('href') === $(this).html())

which mostly works fine.. except that i have some links on my testing page that are causing this to behave very strangely.
the links are of the format: <a href="http://domain.tld/path.ext" target="_blank">(5)</a> and what is occurring is that the .html() method is returning the href value, instead of the html value! i can see this by dumping the values via console.log.

has anyone seen this behavior before? got any tips?
thanks

__________________
Added after 16 Hours 14 minutes:

i found the solution to this: the combination of variable declarations, scope and operator comparisons was causing unexpected outcomes!
 
Last edited:
Status
Not open for further replies.
Back
Top