Last active
August 29, 2015 14:16
-
-
Save wsmoak/993d65c9febc2a36e7ae to your computer and use it in GitHub Desktop.
Chargify Custom JavaScript and Custom CSS
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
.field-error { | |
color: #b94a48 !important; | |
background: #f2dede !important; | |
border: solid 1px #eed3d7 !important; | |
} |
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
$(document).ready(function(){ | |
var customLabel1 = $("label[for='metafield_3600']"); | |
customLabel1.text("* " + customLabel1.text()); | |
}); | |
var textField = $("#metafield_3600"); | |
var form = $("#hosted-payment-form"); | |
var submitbtn = $("#subscription_submit"); | |
// require customer to type 'yes' in the text field | |
submitbtn.click(function(){ | |
if ( textField.val().toLowerCase() !== "yes" ) { | |
textField.addClass("field-error"); | |
return false; | |
} | |
}); | |
form.change(function(){ | |
if( textField.val() != ""){ | |
textField.removeClass("field-error"); | |
submitbtn.click(function(){ | |
return true; | |
}); | |
} else { | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment