Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html5-form-validator

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html5-form-validator

The most simple HTML5 form validator

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135
increased by46.74%
Maintainers
1
Weekly downloads
 
Created
Source

HTML5 Form Validator

The most simple HTML5 forms validator

Install

npm i html5-form-validator

or

yarn add html5-form-validator

Usage

import 'html5-form-validator';

Then initialize with default settings:

new html5formValidation();

or supply your own

const form = document.querySelector('#form');

new html5formValidation(form, {
  errorElement: 'form__error',
  invalidClass: 'is--invalid',
  submitHandler(instance) {
    console.log(instance)
  },
  validateOnInput: false
});

Options

errorElement - The classname of the element that will be added to the dom after the required field. Defaults to error.

invalidClass - The classname of the required field when it is invalid. Defaults to invalid.

submitHandler - A function to run on valid form submission. Accepts a single instance argument which refers to the constuctor's instance. Defaults to null.

validateOnInput - Set to false if you want to show visual feedback for invalid fields after the first invalid submission. Defaults to true.

Keywords

FAQs

Package last updated on 27 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc