pointer-events 可以拿來使一個element停用(例如button)

  • 1215
  • 0
  • css
  • 2018-08-27

pointer-events

一直用disabled去阻止按鈕,結果一點反應也沒有

所以找到另一個方法是,pointer-events:none

https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

$(".submit").css({
 backgroundColor: "rgba(153, 153, 153, 0.2)",
 cursor: "not-allowed"
}).prop({disabled: !0});
$("form").submit();
 .notactive {
        pointer-events: none;
        cursor: default;
    }