Форум по Javascript
Anonymous
Не суммируйте функцию JS [закрыто]
Сообщение
Anonymous » 14 июл 2025, 16:17
Код: Выделить всё
// acsesProperty buttons display
let typeBtns = document.querySelectorAll("#typeBtn");
let acsesPropertys = document.querySelectorAll("#acsesProperty");
typeBtns[0].addEventListener("click", () => {
acsesPropertys[0].classList.remove("d-none");
acsesPropertys[1].classList.add("d-none");
acsesPropertys[2].classList.add("d-none");
});
typeBtns[1].addEventListener("click", () => {
acsesPropertys[1].classList.remove("d-none");
acsesPropertys[0].classList.add("d-none");
acsesPropertys[2].classList.add("d-none");
});
typeBtns[2].addEventListener("click", () => {
acsesPropertys[2].classList.remove("d-none");
acsesPropertys[1].classList.add("d-none");
acsesPropertys[0].classList.add("d-none");
});
Я пишу этот код, но это так долго, эта функция управляет типами, нажимающими показать или скрыть acsespropertys
Подробнее здесь:
https://stackoverflow.com/questions/797 ... s-function
1752499074
Anonymous
[code]// acsesProperty buttons display let typeBtns = document.querySelectorAll("#typeBtn"); let acsesPropertys = document.querySelectorAll("#acsesProperty"); typeBtns[0].addEventListener("click", () => { acsesPropertys[0].classList.remove("d-none"); acsesPropertys[1].classList.add("d-none"); acsesPropertys[2].classList.add("d-none"); }); typeBtns[1].addEventListener("click", () => { acsesPropertys[1].classList.remove("d-none"); acsesPropertys[0].classList.add("d-none"); acsesPropertys[2].classList.add("d-none"); }); typeBtns[2].addEventListener("click", () => { acsesPropertys[2].classList.remove("d-none"); acsesPropertys[1].classList.add("d-none"); acsesPropertys[0].classList.add("d-none"); }); [/code] Я пишу этот код, но это так долго, эта функция управляет типами, нажимающими показать или скрыть acsespropertys Подробнее здесь: [url]https://stackoverflow.com/questions/79700938/dont-summarize-js-function[/url]