search

Home  >  Q&A  >  body text

How to trigger the in-focus state of a button when another button is focused or has focus?

View reference

When a (button) library name is selected or clicked, I want the next inactive button to become active (turn bright red).

I googled and found that there is a (blur) and (focus) event in angular

P粉257342166P粉257342166230 days ago424

reply all(1)I'll reply

  • P粉164942791

    P粉1649427912024-04-03 13:19:24

    You can disable and enable buttons via JavaScript:

    const normalButton = document.querySelector('.normal');
    const disabledButton = document.querySelector('.disabled');
    
    disabledButton.disabled = true;
    
    normalButton.addEventListener("click", ()=> {
        disabledButton.disabled = false;
    })

    Click on 'aaaa' button to enable the other button

    reply
    0
  • Cancelreply