Can't make the validation work in Bootstrap 4

前端 未结 2 351
旧巷少年郎
旧巷少年郎 2020-12-08 10:31

I\'m trying to implement validation by Bootstrap and I\'ve pasted the following sample on my page:

2条回答
  •  Happy的楠姐
    2020-12-08 11:08

    Validation has changed as of the Bootstrap 4 beta release.

    The valid state selectors use the was-validated class which would be added dynamically after validating the form via client-side JavaScript. For example...

    Success! You've done it.
    That didn't work.

    https://www.codeply.com/go/45rU7UOhFo

    Update 2019 - Bootstrap 4.0.0
    Form Validation Example Demo


    As explained in the docs, if you intend to use server-side validation you can simply set the is-valid or is-invalid classes on the form-controls...

    Success! You've done it.

提交回复
热议问题