<body>
<div class="container mt-5">
<h1>Личный кабинет</h1>
<p>Имя: <span><?= $_SESSION['name']?></span>
<span class="edit-btn" >[Изменить]</span>
<span class="save-btn" hidden>[Сохранить]</span>
<span class="cancel-btn" hidden>[Отменить]</span>
</p>
<p>Фамилия: <span><?= $_SESSION['lastname']?></span>
<span class="edit-btn" >[Изменить]</span>
<span class="save-btn"hidden>[Сохранить]</span>
<span class="cancel-btn"hidden>[Отменить]</span>
</p>
<p>E-mail:<?= $_SESSION['lastname']?> </p>
<p>Id:<?= $_SESSION['lastname']?> </p>
</div>
<script>
let edit_buttons = document.querySelectorAll(".edit-btn");
let save_buttons = document.querySelectorAll(".save-btn");
let cancel_buttons = document.querySelectorAll(".cancel-btn");
for (let i = 0; i < edit_buttons.length; i++) {
let inputValue = edit_buttons[i].previousElementSibling.innerText;
edit_buttons[i].addEventListener("click", () => {
edit_buttons[i].previousElementSibling.innerHTML = `<input type="text" value="${inputValue}">`;
save_buttons[i].hidden = false;
cancel_buttons[i].hidden = false;
edit_buttons[i].hidden = true;
});
save_buttons[i].addEventListener("click", () => {
edit_buttons[i].hidden = true;
save_buttons[i].hidden = true;
cancel_buttons[i].hidden = false;
})
cancel_buttons[i].addEventListener("click", () => {
edit_buttons[i].hidden = false;
edit_buttons[i].previousElementSibling.innerHTML = inputValue;
save_buttons[i].hidden = true;
cancel_buttons[i].hidden = true;
})
};
</script>
let arr = [1, 2, 6, 6, 7, 8];
for (let i = 0, j = i + 1; i < arr.length, j < arr.length; i++, j++) {
if (arr[i] === arr[j]) {
console.log("da");
} else {
console.log("Net");
}
}