So, im trying to build a random border color, in a div, from this pre determinated hex codes, but i'm missing something.
Anyone know a good way to do this? i'm still pretty amateur in js and the codes over here do not seem to work on the context.
document.addEventListener('DOMContentLoaded', function() {
var randomNumber = Math.floor(Math.random() * 4);
var id = ['e789ad', '1cfeff', 'ffffff', 'ffffff', '363877',];
console.log(randomNumber);
document.querySelector("div.menu").style.borderColor = "#" + id[randomNumber.lenght]+ ";";
});
Aucun commentaire:
Enregistrer un commentaire