Article Image
read

Need to create HTML id attributes dynamically? Use this simple helper function.

/**
   * Creates a string that can be used for dynamic id attributes
   * Example: "id-so7567s1pcpojemi"
   * @returns {string}
   */
var uniqueId = function() {
  return 'id-' + Math.random().toString(36).substr(2, 16);
};
Blog Logo

Tom Raithel


Published

comments powered by Disqus
Image

frontcoded.com

A dumping ground for web development stuff

Back to Overview