Javascript examples for jQuery:Selector
$("ul li:first") Selects the first <li> element of the first <ul>
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("ul li:first-child").hide(); });/*from w w w .j a v a 2 s . co m*/ }); </script> </head> <body> <p>List 1:</p> <ul> <li>A</li> <li>B</li> <li>Tea</li> </ul> <p>List 2:</p> <ul> <li>A</li> <li>B</li> <li>Tea</li> </ul> <button>Click me</button> </body> </html>