Javascript examples for jQuery:Tag Traversing
Find href inside a H3
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){//from w w w . ja va2s . c o m console.log($('.product h3 > a').attr('href')); }); </script> </head> <body> <div class="product" style="opacity: 1;"> <a title="product" href="http://java2s.com">test</a> <h3> <a href="http://java2s.com">Blabla</a> </h3> </div> </body> </html>