Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: query selector by href 
Javascript :: How to clear localStorage when browser/tab is closing 
Javascript :: vim total number of lines 
Javascript :: jquery event source 
Javascript :: instantiate object in script godot 
Javascript :: moment get month name 
Javascript :: javsacript split string at position 
Javascript :: node js request download file 
Javascript :: add an image to a div with javascript 
Javascript :: make link disabled in angular 
Javascript :: remove after js 
Javascript :: Form.Control textarea react bootstrap 
Javascript :: js redirect page 
Javascript :: javascript redirect to a page 
Javascript :: vehicle number yup validation 
Javascript :: get class count in jquery 
Javascript :: cypress support ability to set viewport in `before` 
Javascript :: how to create click function in javascript 
Javascript :: material ui disable textfield 
Javascript :: center an element react native 
Javascript :: how to authenticate token in react using axios 
Javascript :: how to copy text in the clipboard in js 
Javascript :: js decode base64 
Javascript :: javascript get text between two strings 
Javascript :: javascript get json keys 
Javascript :: p5.js create button 
Javascript :: check if item exists in localstorage javascript 
Javascript :: npm react-native-async-storage 
Javascript :: javascript confirm delete 
Javascript :: filter duplicates from array javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =