tags:

views:

50

answers:

1

I've got this dom:

<a class='foundTag' id=261 href=''>
    <span class=name>wimbledon<\/span>
    <span class=subscribers>(0)<\/span>
    <span class=threads>(0)<\/span>
<\/a>
<a id=263 href=''>
    <span class=name>wini<\/span>
    <span class=subscribers>(0)<\/span>
    <span class=threads>(0)<\/span>
<\/a>

It's 2 links, the first one with class='foundTag' (the spans are inside the links). I want to select the next tag and alert its id. I used:

 alert($('a.foundTag').next().attr('id'));

but it didn't work. Do you guys know why?

UPDATE: sorry guys...my bad..the first link was not a sibling to the second one. so next() wouldnt work. i had to use parent().next().children(':first') instead.

should we close this thread?

+3  A: 

This works if you change the escaped ending tags with normal ending tags. Make sure jQuery is loaded. Also it is possible you have a javascript error above, try to segregate it.

Yuriy Faktorovich
those escaping characters are added automatically. i echo out the right format from php file to jquery ajax but it escapes like that. they are all displayed correctly in the web browser. it should be like that i guess...try echo out a link from php ... it will be automatically escaped...use firebug to check.
weng