Get span text Jquery
I am trying to retrieve a span text -cnn.com from the below structure using jquery. var txt = $(".example1 >.myNewTest").closest('.subexample2').find('span').text(); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="example1" id="test1"> <div id="wkTest" class="myNewTest"> <h2 class="subexample2"> <span class="moreTest></span> <span>cnn.com</span>---->I need this. <span>/</span> <span>News</span> </h2> </div> </div>