I have a form that is submitted by clicking a button via jquery. While the form is running it puts some custom html in #results like so:
$('#run-scraper').click(function() {
$('#scraper-form').submit();
$('#results').html('<div class="loading">Scraping odds. Please wait...<br><img src="/images/ajax-loader.gif">');
});
Im using jquery-form-validation below. What I want to do is clear out the results div on error. But its not working. The HTML stays there when it errors out. How do I access the results after it was added when the button was clicked?
$.validate({
form : '#scraper-form',
errorMessagePosition : 'top',
validateOnBlur : false,
scrollToTopOnError : false,
onError : function($form) {
$('#results').html('');
}
});
use like below