-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
50 lines (43 loc) · 1.57 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
45
46
47
48
49
50
"use strict";
// Xác thực email
document
.querySelector(".personal-input button")
.addEventListener("click", function () {
const emailInput = document.querySelector(".personal-input input").value;
if (!emailInput) {
alert("Chưa nhập email");
return;
}
const matchEmail =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!matchEmail.test(emailInput)) {
alert("Email không hợp lệ");
return;
}
document.querySelector(".personal-input").classList.add("hidden");
document.querySelector(".personal-detail").classList.remove("hidden");
});
// Ẩn thông tin nghề nghiệp
document.querySelectorAll(".job-content").forEach((contentElem) => {
contentElem.classList.add("hidden");
});
document.querySelectorAll(".job-card").forEach((cardElem) => {
const headElem = cardElem.querySelector(".job-head");
const viewBtn = headElem.querySelector(".job-btn");
const contentElem = cardElem.querySelector(".job-content");
viewBtn.classList.add("hidden");
cardElem.addEventListener("mouseover", function () {
viewBtn.classList.toggle("hidden");
});
cardElem.addEventListener("mouseout", function () {
viewBtn.classList.toggle("hidden");
});
viewBtn.addEventListener("click", function () {
contentElem.classList.toggle("hidden");
if (contentElem.classList.contains("hidden")) {
viewBtn.innerHTML = "▼ view more";
} else {
viewBtn.innerHTML = "▲ view less";
}
});
});