Skip to content

Instantly share code, notes, and snippets.

@cmc333333
Created October 3, 2014 22:51
Show Gist options
  • Select an option

  • Save cmc333333/ccfe387e1923779eeedf to your computer and use it in GitHub Desktop.

Select an option

Save cmc333333/ccfe387e1923779eeedf to your computer and use it in GitHub Desktop.
'use strict';
// Namespace
var Init = {
// State/Zip are only marked "required" if country == USA
countryRequirements: function() {
var country = $('#id_country'),
countryReqLabels = $('label[for=id_state], label[for=id_zip_code]');
country.change(function() {
if (country.val() === 'USA') {
countryReqLabels.addClass('required');
} else {
countryReqLabels.removeClass('required');
}
});
},
// Donations in dedication to someone have additional fields
dedicationFields: function() {
var dedication = $('#id_dedication'),
dedicationDiv = $('#dedication_details');
}
};
$(document).ready(function() {
Init.countryRequirements();
Init.dedicationFields();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment