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 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #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

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
How to use Context in React?ReactWordPress: How to find all posts from a custom post type with specific custom field?WordPressIf statement shorthand examples in JavaScriptJavaScriptRIGHT JOIN in PostgresPostgresHow to add Read More Read Less Button using JavaScript?JavaScriptHow to import a CSS file using PHP code and not HTML code?PHPKanban vs Scrum: The two frameworks of agile principlesMiscellaneousReview an intentionally vulnerable plugin in WordPressWordPressHow to create Glowing Texts using CSS?CSSConfiguring Modules with @forward rule in SCSS (Sass)SCSSArray.from() Method in JavaScriptJavaScriptHow to make HTML form interactive and using CSS?CSS