Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

jQuery: Border around all list items that are children of a specified class of an unordered list

jQuery Fundamental - II : Exercise-57

Write a program to places a border around all list items that are children of a specified class of an unordered list.

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Border around all list items that are children of  a specified class of an unordered list.</title>
</head>
<body>
<ul class="tutorial">
<li>Frontend</li>
<li>Backend
<ul>
<li>C#</li>
<li>Java</li>
<li>PHP</li>
<li>Python</li>
</ul>
</li>
<li>Database
<ul>
<li>MySQL</li>
<li>PostgreSQL</li>
<li>SQLite</li>
<li>Oracle</li>
</ul>
</li>
</ul>
</body>
</html>

JavaScript Code :

$( "ul.tutorial > li" ).css( "border", "3px double blue" );

See the Pen jquery-fundamental-exercise-57 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

Previous: Finds the checked radio input.
Next: Using jQuery find all children of each division.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.