I have a button in a for loop.
<button name="btnD" id="btnDetail" class="ddd" value="${comp.contentId}">Detail</button>
Those buttons will have the same name attribute in the HTML output. When I click one of them, I want to get the value attribute of it in jQuery.
Here is my script :
var btnDetail = $('button[name*="bd"]');
I know btnDetail is a list buttons that have name attribute containing "bd", but I can’t get the exact button which is just been clicked. How can I achive this?
Use “this” – it will refer to the current element
or: