Created
May 4, 2015 17:47
-
-
Save wsmoak/aa285f7210bf5278ac86 to your computer and use it in GitHub Desktop.
Chargify - Default component quantity to 1 and require quantity to be > 0
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
$(function () { | |
var component1 = $("#component_allocated_quantity_XXXXX"); | |
component1.val(1); | |
$("#subscription_submit").click(function(){ | |
if ( component1.val() <= 0 ) { | |
component1.addClass("field-error"); | |
return false; | |
} | |
}); | |
component1.blur(function(){ | |
if ($(this).val() > 0 ) { | |
$(this).removeClass("field-error"); | |
} else { | |
$(this).addClass("field-error"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment