Skip to content

Instantly share code, notes, and snippets.

@sc0ttkclark
Last active December 24, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sc0ttkclark/6784315 to your computer and use it in GitHub Desktop.
Save sc0ttkclark/6784315 to your computer and use it in GitHub Desktop.
var custom_zip_search = '<div class="zip-search">'
+ '<label class="alignleft">Enter Zip:<span class="help alignright"></span></label>'
+ '<input type="text" name="zip_code_ZIPID" />'
+ '<div class="add-zip alignleft"><span class="green-arrow"></span> <span class="available">Available</span> For You To Represent.'
+ '<p><a href="#" class="add-another">Add another zip code for $100 annually</a></p>'
+ '</div></div>';
$( '.checkout-2 .gfield_checkbox li' ).each( function() {
var $this = $( this ),
$checkbox = $( 'input[type="checkbox"]', $this ),
val = $checkbox.val(),
checked = $checkbox.prop( 'checked' );
if ( !checked ) {
$this.remove();
}
else {
var this_zip_search = custom_zip_search.replace( 'ZIPID', val );
$this.append( this_zip_search );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment