Web.QHMIT
.com
Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
Run
<!doctype html> <title>Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> $( function() { $( "button" ).click( function() { $( "li:nth-child(3)" ).siblings().css( "background-color", "yellow" ); }); }); </script> <button>Highlight Siblings of the 3rd list items</button> <ul> <li>Apples <ul> <li>Big ones</li> <li>Juicy ones</li> <li>Red ones</li> </ul> </li> <li>Oranges</li> <li>Papaya <ul> <li>Papaya carica</li> <li>Carica</li> <li>Carica pubescens</li> </ul> </li> <li>Lychee</li> <li>Rambutan</li> <li>Passionfruit</li> <li>Mango</li> </ul>
Preview