Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Валидация формы: правка
Browse files Browse the repository at this point in the history
  • Loading branch information
nicothin committed Mar 4, 2019
1 parent 49b5d0a commit d3a623b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/blocks/form-validation/form-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ready(function(){
const fieldsText = Array.from(document.querySelectorAll('input[data-check-pattern]'));
fieldsText.forEach(function(input){
input.addEventListener('blur', function(){ checkFieldText(input); });
input.addEventListener('keyup', function(){ checkFieldText(input); });
});

// Для всех проверяемых чекбоксов
Expand All @@ -39,7 +40,6 @@ ready(function(){
});

function checkFieldText(input) {
input.addEventListener('input', function(){ checkFieldText(input); });
const regExp = new RegExp(input.dataset.checkPattern, 'gi');
const result = regExp.test(input.value);
const errorClass = 'field-text--error';
Expand Down

0 comments on commit d3a623b

Please sign in to comment.