mini js script for form validation. You can add new custom and use it very easy.
this script help you validate data in frontend before submit data for backend.
Demo: https://huyn03.github.io/jquery.validateMini/
JQUERY
jquery.validateMini
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
and
<script src="assets/js/jquery.validateMini.min.js></script>
Html
<form>
<div class="form-group">
<label>Username</label>
<input validates="required|test:3,6" name="username" type="text" class="form-control" value="">
</div>
<div class="form-group">
<label>Password</label>
<input validates="required|between:6,15|strong" id="Password" name="password" type="password" class="form-control" value="">
</div>
<input type="submit" name="" value="send" class="form-control">
</form>
JavaScript
$('form').validateMini({
validates: {
test: (params, value)=> {
return `Params of valid test: ${params[0]} and ${params[1]}`;
},
strong: (params, value)=>{
return /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])/.test(value) || "Yêu cầu chữ cái, số, in hoa và ký tự"
},
}
});
- JQUERY - The javascript framework used
Đinh Thanh Huy DrHuy
This project is licensed under the MIT License - see the LICENSE.md file for details
- Thanks for used
- It help for you: donate me $1: https://paypal.me/huy03