Jquery selector question

Posted by fizzer on Stack Overflow See other posts from Stack Overflow or by fizzer
Published on 2010-03-22T20:50:56Z Indexed on 2010/03/22 20:51 UTC
Read the original article Hit count: 297

Filed under:

Hi,

I have a working selector but I just wondered whether there was another way I could write it. Here's the html structure:

THIS IS TEXT I WANT TO SELECT
    item 1 item 2 item 3

I have a click event attached to the nested listitems. In the click event I am trying to select the anchor tag. I have used the follwing selector:

$(this).parents('li').children('a')

Is this the most efficient way of selecting the anchor tag?

© Stack Overflow or respective owner

Related posts about jQuery