twitter-bootstraphandlerierrorhandler

Bootstrap alert disapperas after a few seconds


I try to create a simple form with Bootstrap and with error handling. I create a form and after the submit clicking the error should appear, but the error only appears for a few seconds ...

Here the code:

http://codebin.org/view/8e8b46ae

Thanks :)


Solution

  • If you want to display the warning, you have to suppress the original form submit behavior by returning false, otherwise the browser processes the form submit.

    if(name.val() == ''){
        ...
       return false;
    }