In coding, Separation of Concerns refers to the delineation and correlation of software elements to achieve order within a system.
Through proper separation of concerns, complexity becomes manageable.
css method to modify element styles. It’s a best practice to group all of the style code in a CSS file and use jQuery to add and remove the classes from elements. This approach aligns to the design principle called separation of concerns.
Lets give an example:
In the example above:
.addClass()is called on the jQuery
'active'class to all
- Attention: The argument passed to
addClassdoes not have a period (.) preceding it. This is because it expects a class, and therefore only needs the name of the class.