Tuesday, January 20, 2015

Jquery trim form fields before submit/validate

Hi everyone here is a snippet that will help you in trimming the input fields before they get validated and submitted any further.

$("#mySignupForm").submit(function() {
        $(this).find('input:text').each(function(){
            $(this).val($.trim($(this).val()));
        });
});


- Happy Coding

No comments:

Post a Comment