I have an HTML content with specific tags which have text and images in it. What if I am able to select an image and I want the the text nearest to an image?
<div class="topStory">
<div class="photo">
<a href="somelink"><img src="someimage.jpg" border="0" alt="Photo"></a>
</div>
<h2><a href="somelink">Text near to someimage.jpg</a></h2>
<p>Some extra text.</p>
</div>
In this case I want the text nearest to someimage.jpg. Is it possible to achieve this using PHP? or may be jQuery?