In this tutorial I’m going to learn how to get onclick get data id using JavaScript get id of the element that has the onclick event.
javascript code
{
data: null,
render: function(data, type, row) {
return `
<div class="row">
<div class="col-6">
<button type="button"
class="edits btn btn-primary"
data-project-name="${data['project_name']}"
data-id="${data['id']}">
Start Wizard
</button>
</div>
</div>`;
}
,
},
$(document).on('click', '.edits', function() {
console.log('amit wizard click ho rha');
var projectName = $(this).data('project-name');
var projectId = $(this).data('id');
console.log('Project Name:', projectName);
console.log('Project ID:', projectId);
// Now you can use the projectName and projectId variables as needed
$('#get_project_name').val(projectName);
$('#exampleModal_getting').modal('show');
});