Set css style for an element

Set a CSS style

Setting the style via the style property: = 'red';['backgroundColor'] = 'red';['background-color'] = 'red';

Multiple styles can be set at the same time by overwriting or updating the cssText property:

// Add new style += 'background-color: red; color: white';

// Ignore previous styles = 'background-color: red; color: white';

Remove a CSS style'background-color');

// Does NOT work'backgroundColor');


Select the text of a textarea automatically
Show or hide an element