javascript - Required attribute on inputs in bootstrap is not working -
this question has answer here:
- defining `required` field in bootstrap 6 answers
why required attribute on inputs in bootstrap not working?
<input type = "text" id = "thisisatext" class= "form-control" required>
use type,it work validator
<form data-toggle="validator" role="form"> <div class="form-group"> <label for="inputname" class="control-label">name</label> <input type="text" class="form-control" id="inputname" placeholder="cina saffary" required> </div> <div class="form-group"> <label for="inputtwitter" class="control-label">twitter</label> <div class="input-group"> <span class="input-group-addon">@</span> <input type="text" pattern="^([_a-z0-9]){3,}$" maxlength="20" class="form-control" id="inputtwitter" placeholder="1000hz" required> </div> <span class="help-block with-errors">up 20 letters, numbers , underscores</span> </div> <div class="form-group"> <label for="inputemail" class="control-label">email</label> <input type="email" class="form-control" id="inputemail" placeholder="email" data-error="bruh, email address invalid" required> <div class="help-block with-errors"></div> </div> <div class="form-group"> <label for="inputpassword" class="control-label">password</label> <div class="form-group col-sm-6"> <input type="password" data-minlength="6" class="form-control" id="inputpassword" placeholder="password" required> <span class="help-block">minimum of 6 characters</span> </div> <div class="form-group col-sm-6"> <input type="password" class="form-control" id="inputpasswordconfirm" data-match="#inputpassword" data-match-error="whoops, these don't match" placeholder="confirm" required> <div class="help-block with-errors"></div> </div> </div> </div> <div class="form-group"> <div class="radio"> <label> <input type="radio" name="underwear" required> boxers </label> </div> <div class="radio"> <label> <input type="radio" name="underwear" required> briefs </label> </div> </div> <div class="form-group"> <div class="checkbox"> <label> <input type="checkbox" id="terms" data-error="before wreck yourself" required> check </label> <div class="help-block with-errors"></div> </div> </div> <div class="form-group"> <button type="submit" class="btn btn-primary">submit</button> </div> </form>
Comments
Post a Comment