Last active
August 30, 2019 20:04
-
-
Save PunchRockgroin/ce4970fad658dbf8c9f468701a40ebff to your computer and use it in GitHub Desktop.
Gravity Perks Limit Choices add message when no more choices available
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add classname .choicless-message to field in GF Admin | |
$('.choiceless-message').each(function() { | |
let $el = $(this) | |
let inputsWithChoice = $el.find('input').length | |
let inputsWithChoiceDisabled = $el.find('input:disabled').length | |
let waitlistHref = $el.data('waitlistHref') || '#' | |
if (inputsWithChoice === inputsWithChoiceDisabled) { | |
$('<div />').addClass('alert alert-warning').html('<p class="mb-0">There are no more open slots available<br /> <a href=".waitlistHref.">Join the waitlist</a></p>').appendTo($el) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment