我有一个链接列表,它们都附有点击事件。我需要从子A链接中获取ID。所以在下面的示例中,如果我单击第一个列表元素,我需要返回google。
我尝试过`'$this a'`,但无法完全弄清楚语法。
我尝试过`'$this a'`,但无法完全弄清楚语法。
$("ul li").click(function(event){
$("input").val($(this).html());
});
<ul>
<li><a href="http://www.google.com" id="google">Google</a>
</ul>