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
id
$('.openembed').click(function () { generateCode(); var answerid = $(this).attr('id'); $('#box').show(); return false; });
Use $(this). $('.openembed') refers to multiple links.