[TASK] add js
This commit is contained in:
17
templates/app.js
Normal file
17
templates/app.js
Normal file
@ -0,0 +1,17 @@
|
||||
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", ""));
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user