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
Steps to Secure a VPNMiscellaneousCREATE TABLE Examples in PostgreSQLPostgresSocial Media Colors: LESS VariablesMiscellaneousThe unique operator($) in Envision BasicEnvision BasicHow to Clone Objects in PHP?MiscellaneousHow to force your website to load securely with an .htaccess file?MiscellaneousThe Difference Between the echo and print Commands in PHPPHPCanvas Drawing in HTML5HTML@forward rule in SCSS (Sass)SCSSHow to create a blurry text effect using CSS?CSSThe Differences Between HAVING Clause and WHERE Clause in SQLSQL/MySQLHow to obfuscate JavaScript code to hide it from View Source?JavaScript