18 lines
543 B
JavaScript
18 lines
543 B
JavaScript
|
document.addEventListener('DOMContentLoaded', function() {
|
||
|
toggleSummary();
|
||
|
});
|
||
|
|
||
|
function toggleSummary() {
|
||
|
const openBtn = document.querySelector('#open-js');
|
||
|
const closeBtn = document.querySelector('#close-js');
|
||
|
const detailElements = document.querySelectorAll('detail');
|
||
|
|
||
|
openBtn.addEventListener('click', function(){
|
||
|
detailElements.forEach((detail) => detail.setAttribute("open", ""));
|
||
|
});
|
||
|
|
||
|
closeBtn.addEventListener('click', function(){
|
||
|
detailElements.forEach((detail) => detail.setAttribute("open", ""));
|
||
|
});
|
||
|
}
|