Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The validation for input type number(n>=0) by JavaScript
export class HogeCustomValidatior {
positiveIntegerValidatator() {
let elm1 = document.getElementById('number_hoge1');
let elm2 = document.getElementById('number_hoge2');
let elms = [elm1, elm2];
elms.forEach(function (elm) {
elm.addEventListener('change', function(event){
if (\D/)) { = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment