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 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

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
How to Create a Backup From Any Database in SQL?SQL/MySQLWhat is a “promise” in JavaScript?JavaScriptHow to show confirmation alerts with OK and cancel buttons using Swift 5?SwiftThe 8 Golden Rules of Programming I Have Learned in My CareerMiscellaneousWhat is DevOps?MiscellaneousHow to convert a number rounding to a specified number of decimals in JavaScript?JavaScript5 Ways to Loop Through JavaScript ArraysJavaScriptHow to check if checkbox is checked or not using JavaScript?JavaScriptCheck If a String Contains a Specific Word in PHPPHPLearn how to use Self JOIN in SQL and MySQLSQL/MySQLReverse a String in JavaScriptJavaScriptHow to import MySQL small sample database into phpMySQL?SQL/MySQL