-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegExp.js
25 lines (23 loc) · 823 Bytes
/
RegExp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(function () {
'use strict';
//start
let sub = document.querySelector('.sub');
let result = document.querySelector(".result");
const test = () => {
result.style.display = "block";
document.querySelector('.input').style.border = "";
let text = document.querySelector('.input').value;
String(text);
let pattern = /[A-z]+/gi;
if (pattern.test(text) == true) {
result.innerHTML = text.match(pattern);
result.style.border = "4px solid green";
} else {
document.querySelector('.input').style.border = "4px solid red";
document.querySelector('.span').style.borderBottom = "3px solid blue";
result.style.display = "none";
}
}
sub.addEventListener('click', test)
//end
})();