.closest
won't work in the context of your markup.
You'll need to traverse the tree in a different way.
http://jsfiddle.net/justiceerolin/zVe69/
$('span:contains("90509BR")').parent().prev('div.little-img')
.append('<img style="float:left;" height="75px" width="75px" id="theImg" src="/images/uploads/EPDM_Yellow_Peroxide_p8sm.png" />');
:contains
does the text search. parent()
goes up to .small
, and prev looks at the element before it.