Skip to content

Instantly share code, notes, and snippets.

@permatis
Created January 21, 2016 12:27
Show Gist options
  • Save permatis/3b57c1ef8ffd0f1ed73c to your computer and use it in GitHub Desktop.
Save permatis/3b57c1ef8ffd0f1ed73c to your computer and use it in GitHub Desktop.
How to resolve problems when you declare a variable in a function or jquery plugin too much.
/**
* As an example, I use jquery plugins Chosen.
*/
$('#firstid').chosen({});
$('#secondid').chosen({});
$('#moreid').chosen({});
/**
* How to resolve : Get id attribute from tag select.
*/
$('select').each( function(i,v) {
$('#'+$(this).attr('id')).chosen({ width: '100%' });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment