'<a href="#" class="point-camera point-camera-'.$style.'"><span class="img-point-camera"><img src="'.$img.'" alt="#"></span><span class="temp_city"><img src="'.$temp.'"><p>22°C</p></span><br>'.$post_name.'</a>' 

You need to pull out the last word $post_name

I try the following way:

 ... $(this).last().text(); 

Displays: 22 ° CTEXT

    1 answer 1

    Since you need the last text node, you can use the contents method to get all the nested nodes and take the last one:

     var node = $('a').contents().last(); console.log(node.text()); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="#" class="point-camera point-camera"><span class="img-point-camera"><img src="" alt="#"></span><span class="temp_city"><img src=""><p>22°C</p></span><br>Текст который нужно найти</a>