Skip to content

Instantly share code, notes, and snippets.

@lscoates
Last active September 9, 2016 18:46
Show Gist options
  • Save lscoates/46ee0160e2af3bf828d891a6b5dbb81c to your computer and use it in GitHub Desktop.
Save lscoates/46ee0160e2af3bf828d891a6b5dbb81c to your computer and use it in GitHub Desktop.
$(document).ready(function() {
var organizationLabel = $('label[for="subscription_customer_attributes_organization"]');
organizationLabel.text(organizationLabel.text() + " *");
});
var form = $("#signup-form");
var organization = $("#subscription_customer_attributes_organization");
var submitBtn = $("#subscription_submit")
submitBtn.click(function() {
if (organization.val() === "") {
organization.addClass("field-error");
return false;
}
});
form.change(function(){
if (organization.val() != "") {
submitBtn.click(function() {
return true;
});
}
});
$("#subscription_customer_attributes_organization").blur(function() {
if ($(this).val() !== "") {
$(this).removeClass("field-error");
} else {
$(this).addClass("field-error");
}
});
.field-error {
border-color: #ff0000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment