Created
February 8, 2019 18:44
-
-
Save Kcko/8d0f10938f632fe8ad610d87e080bcba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* 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