css - Bootstrap 4 beta server side validation after fixing error -
i'm using bootstrap 4.0.0.beta, , can add server-side validation adding .is-invalid
classes inputs invalid upon submission. however, when user fixes error in input (for example filling input required , left unfilled), input still has .is-invalid
class, think can confusing user, because can think input still invalid (even if not).
what elegant way address be? i'm thinking either combine client-side validation or listen changes on inputs .is-invalid
class via javascript, , whenever filled, remove class.
this should achieved using javascript.
if keyup event suffice, can :
inline javascript
<input type="text" class="is-invalid" onkeyup="this.classlist.remove('is-invalid')">
jquery
<input type="text" class="is-invalid">
-
$('input').keyup(function () { $(this).removeclass('is-invalid'); });
Comments
Post a Comment