I have multiple divs(containing input fiels with some unique id in each) which were created dynamically by ejs so they all contain same class name.
I want to make ajax call from only that one div's form(matching the unique id) using jquery. How can i do that?
I found lots of similar questions on google but not what i am looking for. Also before you mark this for duplicate, atleast help me with this.
This is my code:
In ejs:
<% elements.forEach(e => { %>
<input class="uniqId" value="<%=e.id%>">
<button type="button" class="btn">
<% }) %> //looping through all the data i have and storing unique value in input field
In the javascript/jquery part:
$('.btn').on('click', () => {
$('input.uniqId').val();
//and then i want to perform ajax call from that specific input field data(the one whose button i clicked)
});