I tried to set it up when pressing a "a" key to open in order, but it opens all at the same time.
Expected outcome:
- "a" key = open Details1
- "a" key = open Details2
- "a" key = open Details3
document.onkeyup = function(e) {
var e = e || window.event;
if (e.which == 65) {
$('details').attr('open', true);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<details>
<summary>Details1</summary>
test1
<details>
<summary>Details2</summary>
test2
<details>
<summary>Details3</summary>
test3
</details>
</details>
</details>
this way
For information, the details elements work with a
toggleeventand their
openattribute type is Boolean.For more explanation please referto my answer there