jQuery getting ID of clicked link

前端 未结 6 2034
醉话见心
醉话见心 2020-12-18 10:22

I have a modal box in jQuery which I have created to display some embed code. I want the script to take the id of the link that is clicked but I can\'t

6条回答
  •  一生所求
    2020-12-18 11:15

    var answerid = $('.openembed').attr('id');
    

    needs to be

    var answerid = $(this).prop('id');
    

提交回复
热议问题