+ 3

[Solved] Please figure out the mistake here.

Why the buttons aren't changing their color? https://code.sololearn.com/W5yT3O8upzSl/?ref=app

12th Sep 2021, 9:53 AM
Shobhit :)
Shobhit :) - avatar
7 Respuestas
+ 2
What is e in your code ?
12th Sep 2021, 10:02 AM
Abhay
Abhay - avatar
+ 2
【S】【P】[ɪɴᴀᴄᴛɪᴠᴇ] can you tell me how does your code works ?
12th Sep 2021, 10:17 AM
Abhay
Abhay - avatar
+ 1
The colours i.e, black, white, cyan and hotpink. Actually I made a mess of the code.
12th Sep 2021, 10:05 AM
Shobhit :)
Shobhit :) - avatar
+ 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.
12th Sep 2021, 11:47 AM
Shobhit :)
Shobhit :) - avatar
+ 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.
12th Sep 2021, 11:53 AM
Abhay
Abhay - avatar
+ 1
Your first question's answer is Yes.
12th Sep 2021, 12:13 PM
Shobhit :)
Shobhit :) - avatar
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; } } }
12th Sep 2021, 12:29 PM
Abhay
Abhay - avatar