
February 15th, 2013, 10:24 AM
|
|
|
|
jQuery - Jquery validate extension - need help with image on error?
ok so i am using the jquery validator plugin:
http://jquery.bassistance.de/validate/demo/
in the error placement function, I want to add the image before the input text box, but this doesnt seem to be working
here is the portion of my js
Code:
$(document).ready(function() { $(".error_image").css('visibility',"hidden");
var validator = $("#main_form").validate({
......
// the errorPlacement has to take the table layout into account
errorPlacement: function(error, element) {
//element.siblings(".field_status").html(error)
element.siblings(".error_images").css('visibility','visible');
},
});
note that if i undo the // in error placement, that works..
Here is my HTML code
Code:
<div class="form_element">
<span class="error_image">
<img src="expired.png"/>
</span>
<label for="first_name_r">First Name*</label>
<input id="first_name_r" type="text" placeholder="John" name="first_name_r" autofocus/>
<div class="field_status"></div>
</div>
|