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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/jquery-exercises/2/jquery-fundamental-exercise-57.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics