jQuery child of clicked element

后端 未结 3 663
粉色の甜心
粉色の甜心 2020-12-09 17:02

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

3条回答
  •  既然无缘
    2020-12-09 17:47

    You could use the children method:

    $(this).children('a').eq(0).attr('id');
    

    I'm not sure about the syntax, but something like this should work.

提交回复
热议问题