Commit d3a623b5 authored by Nikolay Gromov's avatar Nikolay Gromov

Валидация формы: правка

parent 49b5d0a3
......@@ -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); });
});
// Для всех проверяемых чекбоксов
......@@ -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';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment