jQuery child of clicked element

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2008-12-11T13:48:43Z Indexed on 2010/05/25 9:31 UTC
Read the original article Hit count: 187

Filed under:
|
|

Hi,

I've got a list of links which have a click event attached to them, I need to get the ID from the child A link. So in the example below if I clicked the first list element I'd need google retuned.

I've tried '$this a' but can't quite work out the syntax.

jQuery:

$("ul li").click(function(event){
$("input").val($(this).html());			  
  }
);



html:
<ul>
    <li><a href="http://www.google.com" id="google">Google</a>
</ul>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors