2021年3月28日星期日

opens one after another with a shortcut

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:

  1. "a" key = open Details1
  2. "a" key = open Details2
  3. "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>
https://stackoverflow.com/questions/66848277/details-opens-one-after-another-with-a-shortcut March 29, 2021 at 11:03AM

没有评论:

发表评论