How to Check if element has class in JavaScript

CSS classes are very helpful when need to add same style on multiple HTML elements. However, classes are not limited to styling alone; they also enable us to perform various actions based on the presence or absence on an element.

In this tutorial, I show how you can check specific class on single or multiple elements using JavaScript with examples.

How to Check if element has class in JavaScript

Read more

How to check Username Availability using JavaScript and PHP

When creating an online community, website, or social profile, it can be challenging to come up with a username that’s not already taken.

If the username is available, then the user can proceed with registration. If it isn’t, then the user must have to try again with a new username until they find one that is available.

This post will help you check username availability using JavaScript and PHP.

I am using the MySQL database in this tutorial.

How to check username availability using JavaScript and PHP

Read more

Allow Only One Checkbox to be Checked using jQuery and JavaScript

HTML checkboxes are commonly used to enable users to select multiple items from a list, while radio buttons are used for exclusive single selections.

However, there are instances where a checkbox is preferred over a radio button, even when only one option should be selected.

In this tutorial, I show how you can allow only one checkbox selection using jQuery and JavaScript.

Allow Only One Checkbox to be Checked using jQuery and JavaScript

Read more