I am trying to select a div and change its background image but only if the a element before it exists and has a certain ID. See the following:
<td class ="thumbnails">
<a name="abc" id ="def"></a>
<div class="bgimages"></div>
</td>
How would I select and change the background image of the div with class 'bgimages' based on whether or not it has the a element before it with the ID 'def'?