jQuery plugin for adding filters to forms input and textarea, like numeric input only.
npm install jquery.inputfilter
import after jquery and configure inputfilter()
to the jquery elements you want to apply filter
import $ from "jquery";
import "jquery.inputfilter";
// Standard options
$("input, textarea").inputfilter();
// Set options
const options = { allowNumeric: true, allowText: true };
$("input, textarea").inputfilter(options);
const options = {
allowNumeric: true, // is numbers allowed [0-9]
allowText: false, // is text allowed [a-z|A-Z]
allowEnter: true, // is Enter allowed
allowCustom: [], // Array of chars to allow
regex: null, // Regular expression of allowed chars
maxLength: null, // Numeric value representing the maximum number of chars permitted
actionLog: false, // Log actions
};
Copyright © 2015 Anders Fjällström, licensed under the MIT License