Implement changes to the element using the style
object:
modify.style.cssFloat = "left";
modify.style.margin = "0px";
(Please note that it is cssFloat
, not float
, when working with JavaScript. This distinction was made because float
was considered a "future reserved word" in the ECMAScript specification 3rd edition [though it is no longer in ES5], and naming conflicts must be avoided when defining property names within literal notation. Hence, names like cssFloat
were chosen to resolve this conflict.)
When dealing with properties containing hyphens, utilize camelCase instead:
modify.style.backgroundColor = "#eee";