My boss asked me to program a custom jQuery validation plugin. If <input />
tag has special attribute [needcheck]
, my plugin must determine the type of [needcheck]
and check input data before submit.
For example:
<input name="email" type="text" needchek=”Email”/>
If value of <input />
tag has errors, plugin must show a promting message.
Available types for [needcheck]
:
Date:[FORMATDATE]
– date in format (For exampleDate:dd.MM.yyyy
)Time:[TIMEFORMAT]
– time in format (for exampleTime:HH:MM:SS
)INT
– integer numberDecimal:[DECIMALFORMAT]
– Decimal numberEmail
– email address- Etc.
The code:
(function($) {
$.fn.somePlugin = function(options) {
var defaults = {
someOption: 'someValue'
};
var opts = $.extend(defaults, options);
};
})(jQuery);