Last active
September 9, 2016 18:35
-
-
Save lscoates/7f6be2ecd83fb87ba864dbe5b9f0fc49 to your computer and use it in GitHub Desktop.
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
// 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