How to get the data from an adjacent column when clicking on a button/icon in the same row using JS?
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I was able to get the data from the first and second columns, but after I added an icon, it’s not working anymore. I’d assume it needs to get to another level so that it can then go in and reach that wanted cell data, but I don’t know how to go about that and He knows I’ve tried.
This is the Fiddle
and here’s the code snippet:
function deleteTask() {
const dataTr = event.target.parentNode;
const cancelTaskId = dataTr.parentNode.querySelectorAll(“td”)[1].innerText;
const clientId = dataTr.parentNode.querySelectorAll(“td”)[0].innerText;
let data = [];
data.push([clientId, cancelTaskId]);
const td = event.target.parentNode;
const tr = td.parentNode;
tr.parentNode.removeChild(tr);
}
Appreciate any help!
أضف إجابة