Form submits when input is null


#1

I want to prevent form submission when there is no input in the text boxes but the form submits even when the input is empty. How do I fix this?



var input = $("#zip").val();
var input1 = $("#phone").val();

if ( $.trim(input).length == 0 || $.trim(input1).length == 0 ){
event.preventDefault();
}


#4

This response on SO covers the question well...


#5

Thank you mtf.Post must be at least 20 characters.This is filler.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.