I have several buttons each with a different background color. When the user clicks on one of these buttons I want to change the context fillStyle to the value of the button's background css property. It's not working how I thought it would.
In the code above the id of the button is passed to the function. Yet despite setting the background property in the css file to blue, when I print out the style property in an alert it displays nothing. The code below does work by changing the color of the button to green.
So why doesn't button.style.background print out the background property? Is it possible to set the context fillStyle to the css property this way?
Bear Bibeault wrote:There is no such property as fillStyle.