I'm supposed to create 45 color swatches. I want to be able to use the hex value for the color swatch as well as pass the hex value to a function through an onClick event. How?
Below is my code.
<input class="colBtn c1" id="cp1" type="button" onclick="colChg('#FF6600')" />
function colChg(val) {
  <!-- do something... -->
}
css
.colBtn {
    border: 0.5px outset #000;
    height:15px;
    width:15px;
    cursor:pointer;
    float:center;
}
.c1{
    background-color: #000000;
}
I'want to be able to do something like this:
colVal = array (#ffffff, #cccccc, #ff6600....)
for(i=1;i<45;i++){
<input class="colBtn" id="cp"+i  background-color: colVal[i] type="button" onclick="colChg('colVal[i]')" />
}
}
 
     
     
    