Yogesh Chauhan's Blog

How to apply style to the first-child using jQuery?

in jQuery on March 7, 2021

We can use :first-child Selector in jQuery to apply style on the fly. It selects all first-child of the element specified..

The :first-child selector matches more than one elements for each parent. This method is equivalent to the method :nth-child(1).

This is how we can apply the style to the first elements of each parent using jQuery.

Credit: jQuery Docs


Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Array destructuring and Object destructuring in JavaScriptJavaScriptSelector Lists and Combinators in SCSS (Sass)SCSSHow to use PHPMailer to send an Email via Gmail SMTP Server?PHPLearn to create your skill bar using CSSCSSThe Difference Between isNaN() Method And isNaN() Function In JavaScriptJavaScriptHow to convert datetime to date format in JavaScript?JavaScriptHow does Next.js load pages faster?NextJSWhy it’s not a good idea to create Number objects in JavaScript?JavaScriptHow to get start index and end index (as int) of substring in Swift?SwiftHow to define variables in SCSS (Sass)?SCSSHow to create a for loop in SCSS (Sass)?SCSSAn Example of Cross-site Scripting (XSS) Attack in PHP and How to Avoid It?PHP