This plugin watches the state of a required DOM elements in chosen container and makes changes to their style.
-
Add
jquery.requiredFieldsStyle.1.0.min.js
to your document (located at js folder) -
Set styles observer using something like this
$(function(){
// init plugin to watch required fields in body element
$('body').requiredFieldsStyle();
});
-
styleClass - class which will be added to not completed required fields. Default value is
jquery-rfs
. -
requiredSelectors - describes observable elements. Can be string or array. Default observable elements are inputs with types like text, email or password and "required" attribute. Plus a textarea with "required" attribute.
-
enableAndRun - flag that emit plugin and run all checks. Default value is
true
.
-
enable - enable observers
-
disable - disable observers
-
run - run all checks
- plugin initialization
$('body').requiredFieldsStyle();
- provide your own class, enable and run plugin
$('body').requiredFieldsStyle({ styleClass: 'some-class-here' });
- executing one of the public methods
$('body').requiredFieldsStyle('disable');
- jQuery