Skip to content

jQuery plugin which watches the state of a required DOM elements and makes changes to their style.

License

Notifications You must be signed in to change notification settings

vmelnik-ukraine/jquery-required-fields-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery "Required Fields Style" plugin

This plugin watches the state of a required DOM elements in chosen container and makes changes to their style.

Usage

  1. Add jquery.requiredFieldsStyle.1.0.min.js to your document (located at js folder)

  2. Set styles observer using something like this

$(function(){
    // init plugin to watch required fields in body element
    $('body').requiredFieldsStyle();
});

Available options and methods

Options

  • 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.

Public methods

  • enable - enable observers

  • disable - disable observers

  • run - run all checks

Examples

  • 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');

Requirements

  • jQuery

About

jQuery plugin which watches the state of a required DOM elements and makes changes to their style.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published