I have a form that is loading the results into a div, and jquery validate doesn’t recognize that I need my field validated because there is no actual “Submit” going on, right? How can I bypass this and still validate my field?
$('#IDsearchform').validate({
rules: {
term: {
required: true,
minlength: 2
},
}
});
..no worky 🙁
$(document).ready(function() {
$('#IDsearchform').validate({
rules: {
term: {
required: true,
minlength: 4
},
}
});
$('.activeView').click(function() {
$('.activeMask').slideToggle(250);
$('.list-style-arrow').toggleClass('nudge');
});
function showLoader(){
$('.search-background').fadeIn(200);
}
//hide loading bar
function hideLoader(){
$('.sub_cont').fadeIn(1500);
$('.search-background').fadeOut(200);
};
$('.searchInput').keydown(function(e) {
if(e.keyCode == 13) {
$('#IDsearchform').valid();
showLoader();
$('.sub_cont').fadeIn(1500);
$('.content .sub_cont').load('superfetch.php?val=' + $('.searchInput').val(), hideLoader());
e.preventDefault();
}
});
$('.searchBtn').click(function(){
$('#IDsearchform').valid();
//show the loading bar
showLoader();
$('.sub_cont .loader').fadeIn(1500);
$('.content .sub_cont').load('superfetch.php?val=' + $('.searchInput').val(), hideLoader());
});
});
you can call when you want to validate it
that will return true or false
EDIT with new information