元素禁用的3方式

元素禁用的3方式

参考: https://www.bilibili.com/video/BV14v4y1s78M/?vd_source=5a780d0a07b146ec26fe203babfaa46e

Three ways to disable an element.

  • [disabled]
    • Suitable for form elements, can disable them as a whole (in conjunction with the <fieldset> element).
    • Disables click and keyboard access, supports hover, and matches with :disabled and :enabled.
  • pointer-events: none;
    • Suitable for non-form elements.
    • Disables mouse behavior (clicking, hovering).
    • Cannot prevent keyboard behavior (tab still triggers focus).
  • [inert]

发表评论

您的电子邮箱地址不会被公开。