Skip to content

Instantly share code, notes, and snippets.

@kenu
Created May 25, 2014 17:24
Show Gist options
  • Save kenu/9e17c9fe2c9654502d62 to your computer and use it in GitHub Desktop.
Save kenu/9e17c9fe2c9654502d62 to your computer and use it in GitHub Desktop.
js commons
var commons = {
drop: function (list, i) {
return list.slice(0, i).concat(list.slice(i + 1));
},
getOptions: function(list, vkey, nkey) {
var listHtml = "";
for (var i=0 ; i<list.length ; i++) {
listHtml += "<option value='";
listHtml += list[i][vkey];
listHtml += "'>";
listHtml += list[i][nkey];
listHtml += "</option>";
}
return listHtml;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment