[英]I am doing a typescript project and I am trying to make my edit button to “edit” the row that I have selected. But I have no idea on how to do it
That's my project.那是我的项目。
https://codepen.io/felipewolffo/pen/MWmQZLr https://codepen.io/felipewolffo/pen/MWmQZLr
I appreciate any help!我感谢任何帮助!
// HERE IS WHERE I AM TRYING TO IMPLEMNENT
static editMedication(no) {
if (no.classList.contains("btn-edit")) {
const list = document.querySelector(
"#medication-list"
) as HTMLTableElement;
console.log(list);
}
}
I think a found a way to make it work.我认为找到了一种使其工作的方法。 But looks horrible, there are probably best ways to do that:
但看起来很可怕,可能有最好的方法来做到这一点:
static editMedication(btn, no1?, no2?, no3?, no4?) {
if (btn.classList.contains("btn-edit")) {
const info1 = document.querySelector("#info1") as HTMLTableElement;
const info2 = document.querySelector("#info2") as HTMLTableElement;
const info3 = document.querySelector("#info3") as HTMLTableElement;
const info4 = document.querySelector("#info4") as HTMLTableElement;
no1 = info1.contentEditable = "true";
no2 = info2.contentEditable = "true";
no3 = info3.contentEditable = "true";
no4 = info4.contentEditable = "true";
alert("Select the table to Edit");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.