var ctrl = $("<input />").decimalControl(AllowedDecimalValues).ControlContainer();
$.fn.decimalControl = function (Decimalvalues) {
var settings = {
'maxLength': '25',
'defaultvalue': '00.00',
'name': 'decimalcontrol',
'type': 'number'
};
settings.MaxDecVal = Decimalvalues;
return $(this).ControlBuilder(settings);
};
$.fn.ControlBuilder = function (settings) {
return this.val(settings.defaultvalue)
.attr('name', settings.name)
.attr('value', settings.defaultvalue)
.attr('type', settings.type)
.attr('size', settings.maxLength);
};
The first line of the above code throws an error:
Object doesn't support property or method 'decimalControl'.
Please provide help or a alternate solution.
You have to add the
.decimalControl()method BEFORE your code uses it. Put the first line of code that uses the.decimalControl()method after the$.fn.decimalControl = function(...) {...}line that adds that method.