tabIndex doesn't make a label focusable using Tab key

前端 未结 5 2068
夕颜
夕颜 2021-01-31 02:32

I\'m trying to replace checkbox/radio inputs with icons. For this, I need to hide the original checkbox/radio. The problem is, I also want the form to properly support keyboard

5条回答
  •  难免孤独
    2021-01-31 02:46

    For input type radio or checkbox:

    opacity: 0;
    height: 0;
    width: 0;
    min-height: 0;
    line-height: 0;
    margin: 0;
    padding: 0;
    border: 0 none;
    

    and the Js above does the trick sweetly.

提交回复
热议问题