Event on a disabled input

前端 未结 10 2465
攒了一身酷
攒了一身酷 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:12

    I find another solution:

    
    

    Class "disabled" immitate disabled element by opacity:

    
    

    And then cancel the event if element is disabled and remove class:

    $(document).on('click','input.disabled',function(event) {
        event.preventDefault();
        $(this).removeClass('disabled');
    });
    

提交回复
热议问题