Skip to content

Instantly share code, notes, and snippets.

@byrichardpowell
Created November 15, 2012 10:09
Show Gist options
  • Save byrichardpowell/4077810 to your computer and use it in GitHub Desktop.
Save byrichardpowell/4077810 to your computer and use it in GitHub Desktop.
jQuery Or
// Setup global objects
window.SITE = {}
window.SITE.decoration = {};
// Setup the decoration method
SITE.decoration.selects = function( $wrapper ) {
// Search within the wrapper
// Or search wihin the body if $wrapper is undefined
$wrapper.or().find('select').chosen();
}
// Decorate the select once
// the document is ready
$(document).ready( function() {
// Decorate the selects when
// the document is ready
SITE.decoration.selects();
// Later on:
// After part of the page has changed
// and may contain a select that needs decorating
SITE.decoration.selects( $('#updated-wrapper') );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment