简体   繁体   中英

Bootstrap tab validation not working

I am trying to implement validations in my form. When the user clicks next button, then if the required field is invalid then an error should appear, otherwise the next form should appear.

In the next form, if all required fields are valid then the program should submit ajax; otherwise, it should show an error message.

I have created a jsfiddle at jsfiddle.net/amarkotha366/00zmmz9f/2

Please help, as my code is not working properly.

To fix the issue with validating email, you just need to change the type attribute on your first input tag to email instead of text .

For validating password, there are lots of plugins. But in a simple fast way, you can do something like this on your next button click action:

// validating password
if ($("#password").val() != $("#confirm_password").val()) {
    // do whatever your want here
    return;
}

Check out a working example of your code in JSFIDDLE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM