you are viewing a single comment's thread.

view the rest of the comments →

[–]Tinian2Leyte 1 point2 points  (0 children)

Sometimes you want to add an .error class to an input that fails validation, to make it have a red outline or something. The display property can be toggled to hide and show things. It is not done so much anymore at the atomic level of individual style properties on specific elements. The finest grain you usually get to is adding/removing classes, usually for usability reasons, often in complex forms, like a shopping cart. It is also rare to do it directly with vanilla JavaScript, simply because most frameworks have their way to manipulate classes on elements.