Answers for "JAVASCRIPT 2 COLOR GENERATOR"

27

js random hex color

'#'+Math.floor(Math.random()*16777215).toString(16);
Posted by: Guest on February-25-2020
0

generate random color jquery

$("#btn").click(() => {
  var colorCode = "1234567890abcdef";
  var color = "";
  for (var i = 0; i < 6; i++) {
    color += colorCode.charAt(Math.floor(Math.random() * colorCode.length));
  }
  $("#hex").html("HEX: " + "#" + color); //Display hexacode
  $("#displaycolor").css("background", "#" + color); //Display color
});
Posted by: Guest on November-30-2020

Code answers related to "JAVASCRIPT 2 COLOR GENERATOR"

Code answers related to "Javascript"

Browse Popular Code Answers by Language