YogeshChauhan . com

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 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

Configuring Modules with @forward rule in SCSS (Sass)SCSSURL paths in DrupalDrupalHow to display and animate image on scroll using JavaScript?JavaScriptHow to remove border from :visited image, link or button?CSSSpecificity of attribute selectorsCSSHow to check if the page is single post page in WordPress?WordPressLearn to Implement Estimated Reading Time using PHP Part 1: The BasicsPHPWhat is XP (Extreme Programming) and When should it be used?MiscHow to overwrite file contents with new content in PHP?PHP5 Ways to Loop Through JavaScript ArraysJavaScriptWhat is an API?MiscHow JavaScript classes allows us to do less typing (syntactic sugar)?JavaScript