CSS !important Rule: How to Use It Correctly

The CSS !important rule approaches us like a fake savior angel in our darkest times while we are trying to make something work in CSS. It is a great option to have for sure, but are we really using it in the correct way and only in cases where we have no other option? In […]

css

Simple CSS z-index Tutorial for Beginners

In this tutorial, we will talk in detail about what CSS z-index property is, how it works, its default value and the values it can have by giving some examples. We will also mention some use cases to give you ideas about where you can apply z-index in your web layouts. What is CSS z-index? […]

css

How to change CSS using jQuery?

The jQuery .css method is used to GET or SET DOM element CSS properties. The following tutorial will demonstrate 4 core concepts of jQuery’s .css method 1. GET a CSS property from a DOM element 2. GET multiple CSS properties from a DOM element 3. SET a CSS property on DOM elements 4. SET multiple CSS […]

angular

ng class Uses Cases, Examples, and Recommendations

ngClass is a very powerful built-in Angular directive for dynamically changing CSS classes on HTML elements. It does this by allowing us to bind scope values as class names. We can then use the state of our application (what variables are currently assigned to) to assign classes to divs, h2s, you name it.  Summed up, […]

javascript logo

JavaScript Events 101

A lot of things happen on webpages. People scroll, click, and move their mouses. Form inputs get entered and typed into. Pages load or get resized. These actions (and many others) are aptly called ‘events’ in web development. And responding to these events is a large part of what makes web applications interactive. Users do […]

Getting to know the ReactJS ecosystem – React and React Native

For new web developers, just learning javascript can be hard enough, let alone trying to understand the dozens of popular libraries, frameworks, services, architectures, preprocessors, bundlers, and other technologies in wide use today. It can all make web development seem esoteric and inaccessible. If you feel this way, you are not alone! I’m here to […]

How to Add/Remove CSS classes using JavaScript

This post will demonstrate two approaches for manipulating the classes of an HTML element. The first uses the plain javascript property classList and the second uses jQuery, a popular javascript library. To begin, consider the following document:

The document has one button with an onclick event to toggle the color of the button. The […]

How to replace all spaces in JavaScript?

In computer programming, “find and replace” is a pretty common task. Any programmer that’s interested in working with textual data should have at least a rudimentary idea of how to write a basic find and replace algorithm. In the JavaScript programming language, find and replace functions are not hard to implement. In the following examples, […]

How to Check If a Key Exists in a JavaScript Object?

JavaScript objects are comprised of properties. Properties in JavaScript are defined as pairs of keys and values. Keys can be generally thought of as the names of the values stored within JavaScript objects. There are a few different ways in which to check if a specific key exists within a certain object. And depending on […]

Working with the Date Object in JavaScript

Getting the current date in JavaScript is a piece of cake. The language features a convenient Date object that’s preloaded with all sorts of methods for retrieving temporal values. The syntax is simple enough and the names of the methods, for the most part, are pretty intuitive. In the following examples, I’ll show you how […]