Koha/koha-tmpl/intranet-tmpl/prog/js/additional-fields-entry.js
Pedro Amorim fcc1934a92
Bug 35044: (QA follow-up): Avoid polluting global scope with functions
using immediately invoked function expression

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:29 +02:00

40 lines
No EOL
1 KiB
JavaScript

(function () {
$(document).ready(function () {
$("#additional_fields_form_section").on(
"click",
".clone_attribute",
function (e) {
e.preventDefault();
clone_entry(this);
}
);
$("#additional_fields_form_section").on(
"click",
".clear_attribute",
function (e) {
e.preventDefault();
clear_entry(this);
}
);
$("#additional_fields_form_section")
.parents("form ")
.submit(function () {
$(".marcfieldget").prop("disabled", false);
return true;
});
});
function clone_entry(node) {
var original = $(node).parent();
var clone = $(node).parent().clone();
$(original).after(clone);
return false;
}
function clear_entry(node) {
var original = $(node).parent();
$("input", original).val("");
}
})();