-
Notifications
You must be signed in to change notification settings - Fork 0
/
validator_button.js
35 lines (33 loc) · 1.11 KB
/
validator_button.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
//runs toggleSearchButton and toggleWarningButton
function toggleButtons(){
var keyword = document.getElementById("keyword");
var searchButton = document.getElementById("searchButton");
var warningButton = document.getElementById("warningButton");
toggleSearchButton(keyword, searchButton);
toggleWarningButton(keyword, warningButton);
}
//Toggles the searchButton, either clickable/submitable or not. Runs once onload.
function toggleSearchButton(keyword, searchButton){
if(keyword.value.length >= 3){
searchButton.disabled = false;
timerValidator = false; //runFunction skips timed event next time
}
else{
searchButton.disabled = true;
}
}
//Toggles warningButton, either display it or not.
function toggleWarningButton(keyword, warningButton){
var fadeTime = 200;
if(keyword.value.length >= 3){
if(warningButton.style.opacity == "1"){
animation("fadeOut "+fadeTime+"ms", warningButton);
warningButton.style.display = "none";
}
}
else{
animation("fadeIn "+fadeTime+"ms", warningButton);
warningButton.style.display = "";
warningButton.style.opacity = "1";
}
}