tags:

views:

58

answers:

3
<td>
    <div class="resumehint"></div>
    <input type="file" id="resume" />
</td>

How to get the div before "#resume" with jQuery?

That is ".resumehint"

+2  A: 
$(this).prev("div")

or

$(this).prev()

or

$(this).prev(".resumehint")

you can replace $(this) with $('#resume') if you are outside a function.

Jason
Seems wrong,right?
Shore
no, it's correct
Jason
Yes, it is: http://docs.jquery.com/Traversing/prev
DR
+1  A: 
$("#resume").prev();
rahul
+1  A: 

Use the Traversing/prev function:

$('#resume').prev('div');

And if you know the CSS class of the div to be more specific:

$('#resume').prev('div.resumehint');
CMS