I have the following html code:
<span class="retrievedValue"><%= f.text_field :DIRECT_LABEL, :class=>"mandatory", :onblur =>"validate_this_textfield(this.value, this.id);" %></span>
<span style="display: none; float: left;"> <img src="../images/green_tick.png" /></span>
I need to display the 'green_tick.png' image when user fills in the field. For this I used the javascript function below:
function validate_this_textfield(field_value, field_id)
{
if( $j('#' + field_id).val() != "") {
$j('#' + field_id ).next().show(); // show next element after field
}
else{
$j('#' + field_id ).next().hide();
}
}
I am using ' .next().show(); ' to show the 'green_tick.png' image, but it does not seem to work.
Any suggestion??
Thanks