views:

292

answers:

2

Here's what I'm trying to do, simplified:

<input rel="TimeStart">
// bunch of HTML code in between
<input rel="TimeEnd">

In the Javascript:

$("[rel="TimeEnd]").blur(function() {
    // find first previous element named "TimeStart"
    // compare their dates
});

I tried using $(this).prev("[rel=TimeStart]") but it keeps returning null. Anybody know what I'm doing wrong?

A: 
$(this).siblings('input[rel=TimeStart]');
ChaosPandion
+2  A: 
$(this).prevAll("[rel=TimeStart]:first")
cobbal