12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Used With Bootstrap</title>
- <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/bootstrap/3.3.5/css/bootstrap.min.css">
- <style>
- .n-bootstrap .msg-wrap {font-size: 14px; margin-top: 3px}
- </style>
- </head>
- <body>
- <div class="container" style="margin-top:30px">
- <div class="col-md-5 col-md-offset-2">
- <form id="form1" data-validator-option="{theme:'bootstrap', timely:2, stopOnError:true}">
- <div class="form-group">
- <label class="control-label">Username</label>
- <input type="text" class="form-control" name="username"
- data-rule="required;username;"
- data-rule-username="[/[\w\d]{4,30}/, 'Please enter 3-12 digits, letters, underscores']"
- data-tip="You can use letters, numbers and periods"
- >
- </div>
- <div class="form-group">
- <label class="control-label">Password</label>
- <input type="password" class="form-control" name="pwd"
- data-rule="Password: required; length(8~16)"
- data-tip="Please fill in at least eight characters"
- >
- </div>
- <div class="form-group">
- <label class="control-label">Verify Password</label>
- <input type="password" class="form-control" name="pwdAgain" data-rule="Verify Password: required; match(pwd)">
- </div>
- <div class="form-group">
- <label class="control-label">Gender</label>
- <select class="form-control" name="gender" data-rule="required">
- <option value="">select ...</option>
- <option value="1">Male</option>
- <option value="2">Female</option>
- <option value="3">Other</option>
- </select>
- </div>
- <div class="form-group">
- <label class="control-label">Email</label>
- <input type="text" class="form-control" name="email" data-rule="required;email">
- </div>
- <div class="form-group">
- <label class="control-label">Interest</label>
- <div class="">
- <label class="checkbox-inline"><input type="checkbox" name="interest" data-rule="checked">sports</label>
- <label class="checkbox-inline"><input type="checkbox" name="interest">movie</label>
- <label class="checkbox-inline"><input type="checkbox" name="interest">game</label>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label">Note</label>
- <textarea class="form-control" data-rule="required;"></textarea>
- </div>
- <div class="form-group">
- <label class="checkbox-inline"><input type="checkbox" id="agree_arguments" data-rule="checked">I agree to the service agreement.</label>
- </div>
- <div class="form-group">
- <button type="submit" class="btn btn-primary">Submit</button>
- <button type="reset" class="btn btn-default">reset</button>
- </div>
- </form>
- </div>
- </div>
- <script src="https://cdn.jsdelivr.net/jquery/1.12.3/jquery.min.js"></script>
- <script src="../dist/jquery.validator.js?local=en"></script>
- <script>
- $(function(){
- // Custom theme
- $.validator.setTheme('bootstrap', {
- validClass: 'has-success',
- invalidClass: 'has-error',
- bindClassTo: '.form-group',
- formClass: 'n-default n-bootstrap',
- msgClass: 'n-right'
- });
- });
- </script>
- </body>
- </html>
|