I am using nodejs and expressjs.
I load a list from a database. Selecting any of the list elements bring up an overlay with to EDIT and DELETE the selected item. I can
Try this:
var box = document.getElementById('box'),
buttons = box.getElementsByTagName('button');
for(var i = 0; i < buttons.length; i++){
buttons[i].id = [ 'my', 'button', 'id', i ].join('-');
}
JsFiddle
Also, you may try to "map" actions:
var box = document.getElementById('box'),
buttons = box.getElementsByTagName('button');
var map = [
'editcustomerform',
'deletecustomer',
'emailcustomer',
'callcustomer',
'gpstocustomer',
'createquote',
'createsalesorder',
'createcashsale'
];
for(var i = 0; i < buttons.length; i++){
buttons[i].id = [ 'my', 'button', 'id', i ].join('-');
buttons[i].onclick = function(){ location.href = [ '/scape', map[i], 'id' ].join('/'); }
}