+ 3
[Solved] Please figure out the mistake here.
Why the buttons aren't changing their color? https://code.sololearn.com/W5yT3O8upzSl/?ref=app
7 Respostas
+ 2
What is e in your code ?
+ 2
【S】【P】[ɪɴᴀᴄᴛɪᴠᴇ] can you tell me how does your code works ?
+ 1
The colours i.e, black, white, cyan and hotpink. Actually I made a mess of the code.
+ 1
Abhay I made a color palette below through which we can choose the colors to fill, than on any above pixel (button) is pressed it shows the selected colour.
+ 1
【S】【P】[ɪɴᴀᴄᴛɪᴠᴇ] if i select a color then i click on any pixel , it should show the color in that pixel only instead of first pixel ,right ?
I changed your code a bit and it was showing color but clicking on any pixel was showing color in first pixel only , that is why i want to confirm if that is what it suppose to do or not.
+ 1
Your first question's answer is Yes.
0
【S】【P】[ɪɴᴀᴄᴛɪᴠᴇ]
var bt;
onload=()=>{
table = document.getElementsByTagName('table')[0];
}
function col(color){
table.onclick = function(e){
if(e.target.id == "bt"){
e.target.style.backgroundColor = color;
}
}
}