Event on a disabled input

前端 未结 10 2460
攒了一身酷
攒了一身酷 2020-11-21 15:53

Apparently a disabled is not handled by any event

Is there a way to work around this issue ?



        
10条回答
  •  爱一瞬间的悲伤
    2020-11-21 16:01

    I would suggest an alternative - use CSS:

    input.disabled {
        user-select : none;
        -moz-user-select : none;
        -webkit-user-select : none;
        color: gray;
        cursor: pointer;
    }
    

    instead of the disabled attribute. Then, you can add your own CSS attributes to simulate a disabled input, but with more control.

提交回复
热议问题