-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
44 lines (38 loc) · 1.17 KB
/
script.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var defaultDisplayPass = "Check i or L here"
function changeText()
{
var phrase = document.getElementById("phrase").value;
var displayPass = document.getElementById('display-phrase');
if (phrase != "")
{
displayPass.innerText = "";
for (let i = 0; i < phrase.length; i++)
{
var span = document.createElement('span');
span.innerText = phrase[i];
if (isNaN(phrase[i]))
{
span.style.color = "white";
// console.log("not number");
}
else
{
// console.log("number");
span.style.color = "red";
}
displayPass.appendChild(span);
}
displayPass.style.fontFamily = "Inconsolata,Consolas,monospace";
// displayPass.style.fontSize = "22px";
}
}
function changeTextOnEnter(e)
{
if (e.key == 'Enter')
{
changeText();
}
}
// Listener for password input and search icon click.
document.getElementById("submit").addEventListener("click", changeText);
document.getElementById("phrase").addEventListener('keypress', changeTextOnEnter);