Welcome
The Nomad blog is where we share news of our projects, thoughts on web development and a weekly round up of things on the Internet that have caught our eye - Tales from the Internet
Tag Cloud
2011 accessibility agencies amazon apple arduino backups bears blog boo book review browsers business c# cablegate captcha charity clients code igniter code snippets community conference contracting cooperation css development dojo eeuk expression engine free full frontal git honey pots html5 installation internet internet explorer ipad java javascript jquery linux little printer micro frameworks mobile multi-touch mvc news nomad osx passwords performance php process rdf recovery remote repository responsive design review s3 security seo silverstripe spam spime svn technology tfi trust underscore url shortening usability version control wii wikileaks windows
Blog » Snippets: Unique Id
Snippets: Unique Id
A very simple function for creating a unique id in JavaScript.
function uniqueId(len) {
var tokens = "abcdefghijklmnopqrstuvwxyz0123456789".split("");
var id = "";
for(var i = 0; i < len; i++)
id += tokens[Math.floor(Math.random() * tokens.length)];
return id;
}