Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return;
}
let max_labels = element.getAttribute("data-max-labels");
let world = element.getAttribute("data-world");
let ajax_obj;
let tagify_args = {
pattern: /^[^:]+:[^:]+$/,
};
if (max_labels !== null) {
tagify_args["maxTags"] = max_labels;
}
let tagify = new Tagify(element, tagify_args);
tagify.on("invalid", function(e) {
let message;
if (e.type == "invalid" && e.detail.message == "number of tags exceeded") {
message = "Only one tag allowed";
} else {
message = "Labels need to be in the format <tt>[KEY]:[VALUE]</tt>. For example <tt>os:windows</tt>.";
}
$("div.label_error").remove(); // Remove all previous errors
// Print a validation error message
var msg = document.createElement("div");
msg.classList.add("message", "error", "label_error");
msg.innerHTML = message;