Javascript examples for jQuery:Tag Traversing
Two context objects in a single jQuery selector
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(window).load(function(){// w w w . j av a2 s . c om $(function () { $('p', '.test, .test2').text('test'); }); }); </script> </head> <body> <div class="test"> <p>masdasd</p> </div> <div class="test2"> <p>masdasd</p> </div> </body> </html>