Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created February 8, 2019 18:44
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 Kcko/8d0f10938f632fe8ad610d87e080bcba to your computer and use it in GitHub Desktop.
Save Kcko/8d0f10938f632fe8ad610d87e080bcba to your computer and use it in GitHub Desktop.
/*!
* getUniqueClass - v1.1 - 2/13/2010
* http://benalman.com/projects/jquery-misc-plugins/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// For when you really need a unique classname, (like when you're cloning a
// whole bunch of elements and don't exactly know where they're going, but need
// to do something with them after they've gotten there).
jQuery.getUniqueClass = function() {
var name, i = 0;
while ( jQuery('.' + (name = 'BA-' + (+new Date) + (i++))).length ) { };
return name;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment