Good day,
I validate the form, tell me where is the error? does not work if / else block

submitForm: function(e) { e.preventDefault(); var form = $(this), submitBtn = form.find('button[type="submit"]'); console.log(app.validateform(form)); if( app.validateform(form) === false ) { alert('false'); return false; }else { alert('ajax next'); } }, 

For any value of true / false, only else works.
Although app.validateform (form) returns true / false
Link to code and form: JSfidle

Please help. Thank.

  • one
    app.validateform(form) === 'false' . Your validateform returns neither true nor false, but quite a string. - andreymal
  • I understood when I declared a variable for some reason I put quotes. Thank you - SilaevD

0