Skip to content

Instantly share code, notes, and snippets.

@sgaem
Created April 5, 2017 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sgaem/0e6015f81f9834e72751f82092914f4d to your computer and use it in GitHub Desktop.
Save sgaem/0e6015f81f9834e72751f82092914f4d to your computer and use it in GitHub Desktop.
$(document).on("dialog-ready", function () {
$(".js-coral-Multifield-add").click(function() {
var field = $(this).parent();
var size = field.attr("data-limit");
if (size) {
var ui = $(window).adaptTo("foundation-ui");
var totalLinkCount = $(this).prev('ol').children('li').length;
if (totalLinkCount >= size) {
ui.alert("Warning", "Maximum " + size + " links are allowed!", "notice");
return false;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment