YogeshChauhan.com

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

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

dreamhost

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 uninstall Cocoapods from the Mac OS? #4 How to Use SQL MAX() Function with Dates? #5 How to add Read More Read Less Button using JavaScript? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Apr 7 Solution for “Yarn build: Failed because of a stylelint error” Apr 7 Make sure your links have descriptive text Apr 7 How to add Laravel to WordPress using Sage theme (and install Tailwind CSS)? Apr 2 How to create a sidebar using pure CSS? Apr 1 How to switch dark and light themes using pure CSS? Apr 1 How to calculate elapsed time in JavaScript?

You might also like these

How to detect the Blog Page in WordPress?WordPressHow to get category name using post id in WordPress?WordPressGeneral concepts in DrupalDrupalThe Differences Between HAVING Clause and WHERE Clause in SQLSQL/MySQLHow to add AppRoutingModule in Angular application using command line?AngularWhat are CSS Specificity Rules and how does browser apply them?CSSHow to add Read More Read Less Button using JavaScript?JavaScriptFULL OUTER JOIN in PostgresPostgresHow to make flexbox items of the same size?CSSHow to create a horizontal scrolling menu with and without flex using CSS (or SCSS)?CSSDROP DATABASE (remove a database) from PostgresPostgresThe SQL EXISTS OperatorSQL/MySQL