So I have a form;
<label for="name">Job Date</label><br /><input id="name" class="required" title="Enter a name!" name="name" type="text" />
and some Jquery to cycle through each input with class "required" and see if it is empty/blank and if so give this input a red border color, and also the label assosciated with it a red color;
function checkreview()
{
var errors = "";
$(".required").each(function (i)
{
if($(this).val() == "")
{
errors += $(this).attr('title')+'<br />';
$(this).css('border-color','#FF0000');
//need to select previous label and set color to red
}
});
}
So I need a selector that will select the previous label and allow me to give it .css('color','FF0000').
Any ideas how to select the previous label in JQUERY?