Available: editor on jQuery
Required: so that when you select color A, the cursor while holding the key repaints the cells in color A. If you select color B in the same way, and so on.
When choosing green, draws green
switch to brown, draws green,
switch to blue draws blue
Further not to do draws in blue
Question: What is the error in my code? And how can it be optimized? Since I have vague doubts that I have done something on the verge of panic and chaos.