Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set property js

There might not seem to be a difference with 'color' but consider:

element.style.backgroundColor = 'blue' // works
element.style['backgroundColor'] = 'blue' // works
element.style['background-color'] = 'blue' // does not work

element.style.setProperty('background-color','blue') // works
element.style.setProperty('backgroundColor','blue') // does not work
Source by softwareengineering.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #set #property #js
ADD COMMENT
Topic
Name
6+5 =