forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus-change-edit-relations.js
More file actions
32 lines (30 loc) · 1001 Bytes
/
status-change-edit-relations.js
File metadata and controls
32 lines (30 loc) · 1001 Bytes
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
$(document)
.ready(function () {
var form = $(".new-relation-row")
.closest("form");
var newRowHtml = form.find(".new-relation-row")
.get(0)
.outerHTML;
var counter = 1;
form.on("click", ".delete", function (e) {
e.preventDefault();
$(this)
.closest(".input-group")
.remove();
});
form.on("keydown", ".new-relation-row input[type=text]", function () {
var top = $(this)
.closest(".new-relation-row");
top.removeClass("new-relation-row");
top.find(".delete")
.prop('Disabled', false)
.removeClass("btn-outline-danger")
.addClass("btn-danger");
top.find("input,select")
.each(function () {
this.name += counter;
});
++counter;
top.after(newRowHtml);
});
});