interactive stack using checkbox s1 and s2 and different functions

前端 未结 1 2012
北荒
北荒 2021-01-26 12:39

I am trying to make working model of Stack in which user can select the stack s1 or s2 and can perform operations like push and pop.

相关标签:
1条回答
  • 2021-01-26 13:09

    I think that you could have more luck with radio buttons. If s1 and s2 were a radio button group, like <input type="radio" name="stack_select" id="stack1" value="s1">s1 <br> <input type="radio" name="stack_select" id="stack2" value="s2">s2

    Then you can listen to when either changes in one function, and have the other ui components update the proper, selected stack.

    The problem with checkboxes for your case is that they aren't mutually exclusive, and it seems like you never want to have both s1 and s2 selected at the same time.

    0 讨论(0)
提交回复
热议问题