nth of type for every 4th after the 1st
:nth-of-type(4n+1)
:nth-child(2)
//https://www.sitepoint.com/comprehensive-jquery-selectors/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>nth-child demo</title>
<style>
div {
float: left;
}
span {
color: blue;
}
</style>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<div>
<ul>
<li>John</li>
<li>Karl</li>
<li>Brandon</li>
</ul>
</div>
<div>
<ul>
<li>Sam</li>
</ul>
</div>
<div>
<ul>
<li>Glen</li>
<li>Tane</li>
<li>Ralph</li>
<li>David</li>
</ul>
</div>
<script>
/*This one is a bit complex.
It can accept a variety of values
as parameter like a number greater than or equal to 1,
the strings even and odd or an equation like 4n+1*/
$( "ul li:nth-child(2)" ).append( "<span> - 2nd!</span>" );
//karl - 2nd
//Tane - 2nd
</script>
</body>
</html>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us