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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#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 #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS? #Jan 8 How to Install Xcode Command Line Tools on MacOS?
You might also like these
How JavaScript classes allows us to do less typing (syntactic sugar)?JavaScriptAngular 9 time clock update every minute, second, hourAngularHow to use @if and @else in SCSS?SCSSCheck If a String Contains a Specific Word in PHPPHPCreate a menu with a curtain falling animation using CSS and JavaScriptCSSRelative Length Units in CSSCSSJavaScript Data Types and Data Structures Things to RememberJavaScriptWhat is ECMAScript?JavaScriptHow to render Lists in React?ReactHow to get the height and width of an element using JavaScript?JavaScriptIN Operator in PostgreSQLPostgresHow to check if the element exists using JavaScript and jQuery?JavaScript