+ 1
Problem with details with JavaScript
Hello, in this code i have add some JS to hidden the rest of <details> in the page, when click on details the other details are hidden and if click again the rest of details is showed. the problem is after the first click if click in other point of details( for exapmle in the text) the function onclick associated run but the details remain open. i have tried to risolve to add: document.getElementId("details").open= 'true'; document.getElementId("details").open= 'false'; but don't work thanks to those who want to help me https://code.sololearn.com/WLcO7JBeMgHw/#
16 Respostas
+ 4
See this code :))
https://code.sololearn.com/WltPavNklhI4/?ref=app
Click on those titles to open the details :))
+ 3
Alessio Farroni
Base on what you wanted your code to do, I refactored your script.
https://code.sololearn.com/WlUdjbDZoyUJ/#html
+ 1
David D. I solved After have see your work, thank's âșïž
+ 1
ODLNT thank you, very nice code. Is very clean and clear. I'll study Itđ
0
Why dont you add another button on the page or part which is opening after clicking button to close it .
0
đźđł AYUSH.ks đźđł because the problem will still remain, if clicking on the text, details does'nt close
0
David D. Thank you, I was thinking to throw away my computer đ ...however I still think where the problem is and how to solve it
0
David D. When its clicked on the text(<p>) of the opened details it has to be closed so that the user has the oportunity to open another details
Thank you so much for helpingâșïž
0
thank you all for your help I solved it by assigning onclick to <summary> instead of <div> or <details>