Sha256: d7ad3896f9687f8230bf6f985aa6831ecdbc4bfd2b0e6d2a7c0e37260563e64c
Contents?: true
Size: 1.23 KB
Versions: 16
Compression:
Stored size: 1.23 KB
Contents
jQuery.fn.uniform = function(settings) { settings = jQuery.extend({ valid_class : 'valid', invalid_class : 'invalid', focused_class : 'focused', holder_class : 'ctrlHolder', field_selector : 'input, select, textarea' }, settings); return this.each(function() { var form = jQuery(this); // Focus specific control holder var focusControlHolder = function(element) { var parent = element.parent(); while(typeof(parent) == 'object') { if(parent) { if(parent[0] && (parent[0].className.indexOf(settings.holder_class) >= 0)) { parent.addClass(settings.focused_class); return; } // if } // if parent = jQuery(parent.parent()); } // while }; // Select form fields and attach them higlighter functionality form.find(settings.field_selector).focus(function() { form.find('.' + settings.focused_class).removeClass(settings.focused_class); focusControlHolder(jQuery(this)); }).blur(function() { form.find('.' + settings.focused_class).removeClass(settings.focused_class); }); }); }; // Auto set on page load... $(document).ready(function() { jQuery('form.uniForm').uniform(); });
Version data entries
16 entries across 16 versions & 1 rubygems