Archive for the ‘css classes’ Category

Conditionally Applying a CSS Class in Vue.js

Posted on: No Comments
There are times you need to change an element's CSS classes at runtime. But when changing classes, it's sometimes best to apply style details conditionally. For example, imagine your view has a pager. Pagers are often used to navigate larger sets of it...

Quick Tip: Add or Remove a CSS Class with Vanilla JavaScript

Posted on: No Comments
Sometimes you need to add or remove a CSS class with JavaScript, and you don't want to include an entire library like jQuery to do it. This is useful in situations when you want your page elements to change in response to user actions. Example uses i...

JavaScript Refactoring Techniques: Specific to Generic Code

Posted on: No Comments
In a recent thread on SitePoint's forums, some code was given to let one dropdown box control when another dropdown box is visible. Even though the code worked just fine, I realized that it left much to be desired. It was brittle and incapable of withs...