MoreOnFew.com – Read tutorials related to JavaScript, jQuery, HTML5, CSS3 and more !

Cover Image for How to check if checkbox is checked in jQuery?

How to check if checkbox is checked in jQuery?

It is very easy to check if a checkbox is checked in jQuery using the .is() or .prop() method of jQuery combined with the ‘:checked’ selector. There are other ways too like checking for the attribute checked value, however, they aren’t very reliable. The easiest and most stable way to check if checkbox is checked … Read more

MoreOnFew
Cover Image for [Solved] Attempted import error: ‘Switch’ is not exported from ‘react-router-dom’

[Solved] Attempted import error: ‘Switch’ is not exported from ‘react-router-dom’

You might be facing an “Attempted import error: ‘Switch’ is not exported from ‘react-router-dom’ ” error if you are using the react-router-dom package version 6. This error is caused due to using the older switch syntax of the react-router-dom. From version 6 onwards, the react-router-dom has replaced “Switch” with “Routes”. Let us take a look … Read more

MoreOnFew
Cover Image for How to check if an element is hidden in jQuery?

How to check if an element is hidden in jQuery?

Whether you are new to jQuery or not, you must have come across a situation where you had to check if an element is hidden in jQuery. While this might sound like an easy task, it can get tricky. Don’t worry, you can check if an element is hidden in jQuery using the simple ways … Read more

MoreOnFew
Cover Image for How to remove a specific item from an array in JavaScript?

How to remove a specific item from an array in JavaScript?

In JavaScript, the Array Object has been one of the most commonly used objects, and hence most of us would already have a good understanding of Array methods. However, there are times when we notice that there might not be a predefined method to achieve a certain task that might seem very common. One such … Read more

MoreOnFew
Cover Image for How to show ellipsis in CSS? Simple solution!

How to show ellipsis in CSS? Simple solution!

We all would have come across scenarios where we wanted to show a certain part or section of a paragraph and then truncate the rest with an ellipsis ( … ) suffixed at the end. An ellipsis in CSS is generally used to show that there is more content, but it has been omitted. The … Read more

MoreOnFew
Cover Image for How to generate UUID in JavaScript? 2 Simple solutions!

How to generate UUID in JavaScript? 2 Simple solutions!

Many times we would have come across scenarios where we wanted to create a unique string in JavaScript that we could use as a unique ID. The obvious thought we would have is to try something with Math.random() or with a mix of Math.random and some Date or time-related object. However, there are many modern … Read more

MoreOnFew
Cover Image for How to get current url in JavaScript?

How to get current url in JavaScript?

JavaScript has come a long way since its inception. I remember the days when it was mainly used only for form validations. Now we use JavaScript for a lot more functionalities. JavaScript has a vast number of APIs which enables us to access a variety of features and information from the browser. One such API … Read more

MoreOnFew
Cover Image for How to install specific version of npm package?

How to install specific version of npm package?

As you might already know, there are a large number of npm packages released every day. An equally large number of updates too get released on the npm registry. While we would like to keep the dependencies in package.json updated to the latest version most of the time, there are still times when we would … Read more

MoreOnFew
Cover Image for Know the difference between tilde and caret in package.json

Know the difference between tilde and caret in package.json

Most of us might have wondered what does the tilde (~) and caret (^) prefixing the version number of the “dependencies” in your package.json file mean. Well, it is important to know the difference between tilde and caret in package.json as the wrong usage can even break your project. Understanding the usage of tilde (~) … Read more

MoreOnFew
Cover Image for How to remove npm package from a project?

How to remove npm package from a project?

NPM or Node Package Manager has made it really easy to install and manage packages in JavaScript projects. The number of packages available on npm has been on an increase and it has become very convenient to install a package in a project using npm. However, over time, it becomes important to remove npm package … Read more

MoreOnFew
Cover Image for How to find outdated packages in npm?

How to find outdated packages in npm?

NPM as a package manager has been a very useful tool in web development. Using npm has made it very convenient for us to add various packages to our web development projects. However, like with other software, our npm packages too get outdated either because a new feature has been introduced, the code has been … Read more

MoreOnFew
Cover Image for How to find unused dependencies in npm?

How to find unused dependencies in npm?

NPM has become the most popular package manager over time. It is really helpful and useful to manage the package dependencies of your project. However, over time, as your project keeps growing and new packages get released, there are times when we move on to a better alternative of a package or even stop using … Read more

MoreOnFew
Cover Image for Uncaught SyntaxError: Unexpected end of input – Causes And Fix!

Uncaught SyntaxError: Unexpected end of input – Causes And Fix!

I know that sometimes the errors we face in JavaScript can be difficult to debug. While with all the modern tools like Chrome developer tools etc the debugging has become far easier, there still are times when we come across issues that are tricky to debug. One such issue is the “Uncaught SyntaxError: Unexpected end … Read more

MoreOnFew
Cover Image for How to replace text in JavaScript

How to replace text in JavaScript

Working with text or strings in JavaScript is really interesting. In fact text or “String” as it is called in JavaScript is the most common data type that a JavaScript programmer would encounter quite often. And many a times your would come across scenarios where you might have to replace a text in JavaScript. Thankfully, … Read more

MoreOnFew
Cover Image for What is the difference between Number.isInteger() and Number.isSafeInteger() in JavaScript ?

What is the difference between Number.isInteger() and Number.isSafeInteger() in JavaScript ?

As a part of ES6 (also known as ECMAScript 2015 or ECMAScript 6), there are a couple of new JavaScript features and methods introduced. Today we would be concentrating on just two of them i.e Number.isInteger() and Number.isSafeInteger(). What is Number.isInteger() ? The Number.isInteger() is a new method of the Number object introduced as a … Read more

MoreOnFew
Cover Image for How to detect support for a CSS feature using @supports ?

How to detect support for a CSS feature using @supports ?

With many new CSS features being introduced regularly it has become important to check for the support of these newer CSS properties before we use them. While there are feature detection tools like Modernizr etc, not every time do we actually require to load a JavaScript file to detect a feature alone. You can do … Read more

MoreOnFew
Cover Image for How to convert LTR website to a RTL Website – LTR to RTL?

How to convert LTR website to a RTL Website – LTR to RTL?

I’m sure all of us want our websites to be visited and loved by people all over the world. However many a time our visitors could be from countries that follow RTL(Right-To-Left) script. And hence we might have to convert our website from LTR to RTL. By RTL script I mean scripts of languages such as … Read more

MoreOnFew
Cover Image for Understanding only-of-type CSS pseudo class selector

Understanding only-of-type CSS pseudo class selector

Let’s be honest, CSS sometimes can get a little tricky and confusing to understand. Especially with the onset of CSS3 and all these new CSS3 selectors and pseudo classes, it’s quite possible that many of us might still be trying to catch up with the new selectors. Well, only-of-type is one such new CSS3 pseudo … Read more

MoreOnFew
Cover Image for What are source maps in CSS and JavaScript?

What are source maps in CSS and JavaScript?

With all the optimization techniques like bundling and minification etc getting important and popular it is good that we talk about Source Maps now. Think of this, once you bundle all the CSS files you have into one single file, how do you know which part of CSS was written in which file? To make … Read more

MoreOnFew
Cover Image for What are CSS Preprocessors?

What are CSS Preprocessors?

A lot is being discussed about CSS Preprocessors in recent times. But then what are they? Is it another framework like Bootstrap? Well, the answer is No. It is not another CSS framework. Preprocessors in general are programs that take one type of data as an input and give out another type of data as … Read more

MoreOnFew