When coding with JS and the DOM I find myself constantly needing to generate ids (or names) that have no purpose other than to group DOM elements together (or r
I agree with some of the commenters that there are probably better ways to do this, but a simple implementation of unique_id() you could use would be:
unique_id()
return Math.random().toString(36);