-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (25 loc) · 774 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function create_tr(table_id) {
let table_body = document.getElementById(table_id),
first_tr = table_body.firstElementChild
tr_clone = first_tr.cloneNode(true);
table_body.append(tr_clone);
clean_first_tr(table_body.firstElementChild);
}
function clean_first_tr(firstTr) {
let children = firstTr.children;
children = Array.isArray(children) ? children : Object.values(children);
children.forEach(x=>{
if(x !== firstTr.lastElementChild)
{
x.firstElementChild.value = '';
}
});
}
function remove_tr(This) {
if(This.closest('tbody').childElementCount == 1)
{
alert("You Don't have Permission to Delete This ?");
}else{
This.closest('tr').remove();
}
}