-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
30 lines (23 loc) · 964 Bytes
/
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
const chiButton = document.getElementById('chiButton');
chiButton.onclick = (function (){
let noDisplay = document.getElementsByClassName('noDisplay');
let englishText = document.getElementsByClassName('english');
let chineseText = document.getElementsByClassName('chinese');
for (let i = 0; i <= englishText.length; i++){
chineseText[i].classList.toggle('noDisplay');
englishText[i].classList.toggle('noDisplay');
if( chiButton.innerHTML === "Chinese"){
chiButton.innerHTML = 'English';
}else {
chiButton.innerHTML = 'Chinese'
};
}
});
// engButton.onclick = (function (){
// let noDisplay = document.getElementsByClassName('noDisplay');
// for (let i = 0; i <= chineseText.length; i++){
// console.log(chineseText[i].classList)
// noDisplay[i].classList.remove('noDisplay');
// chineseText[i].classList.add('noDisplay');
// }
// });