Skip to content

Instantly share code, notes, and snippets.

@lscoates
Last active September 9, 2016 18:35
Show Gist options
  • Save lscoates/7f6be2ecd83fb87ba864dbe5b9f0fc49 to your computer and use it in GitHub Desktop.
Save lscoates/7f6be2ecd83fb87ba864dbe5b9f0fc49 to your computer and use it in GitHub Desktop.
// EXAMPLE of ID in the URL https://subdomain.chargify.com/setup/metafields/1033/edit
$(document).ready(function(){
var customLabel = $("label[for='subscription_metafields_XXX']");
customLabel.text(customLabel.text() + " *");
});
var customInput = $("#subscription_metafields_XXX");
var form = $("#signup-form");
var submitBtn = $("#subscription_submit");
submitBtn.click(function(){
if (customInput.val() === "") {
customInput.addClass("field-error");
return false;
}
});
form.change(function() {
if (customInput.val() != "") {
customInput.removeClass("field-error");
submitBtn.click(function() {
return true;
});
} else {
return false;
}
});
.field-error {
border-color: #ff0000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment