Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>DOM Traversing</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style> .active { font-weight:bold; color:red; } </style> </head> <body> <ul> <li class="item">One</li> <li class="item active">Two</li> <li class="item">Three</li> </ul> <button id="reset">Reset Active</button> <script> $("#reset").click(function(){ $(".item.active").parent().find(".item").removeClass("active"); }); </script> </body> </html>
Output