I need to implement following validations.Please suggest any jQuery plugin for this.
Numeric Number Range : (0-9999) Non Negative Non Decimal
Numeric Number Range : (0-99.99) Non Negative Decimal with more than 2 digits after decimal is not allowed
Numeric Number Range : (0-99999) Non Negative Decimal @ first position or last position
better use server side validations, javascript validations are client-side and can be hacked easily
Edit: using the jQuery validation plugin
$("#myform").validate({
rules: {
field: {
required: true,
range: [0,9999]
}
}
});
The second case is a bit strange, are you passing strings to the database? try with
number: true
max: 99.99
min: 0
You can use the jQuery validation plugin
http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js
http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js
http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js
http://ajax.microsoft.com/ajax/jquery.validate/1.7/additional-methods.js
The demos are available at http://docs.jquery.com/Plugins/validation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.