How can I check if a span exists below my input element and if it exists, I need to add a div dynamically below that span
$('#submit_form .required_text').filter(':visible').each(function () {
var input = $(this);
input.next('div.error_text').remove();
input.removeClass('highlight');
if (!$(this).val()) {
input.addClass('highlight');
input.find('span'){
//then add the div after the span for this element alone
}
else{
input.after('<div class="error_text">Required field</div>');
}
}