Set element to unclickable and then to clickable

前端 未结 6 829
花落未央
花落未央 2021-02-04 04:26

I want to have a div element set to not be clickable and then set it to clickable after another element is clicked.

So, when .case is clicked:

$(\'.case\         


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 05:09

    $('#patient').on('click', function() {
        if ( $(this).hasClass('active') ) {
            // do whatever when it's active.
        }
        return false;
    });
    

    If you just want it to not accept, you can add this to your css (pointer-events):

    #patient { pointer-events: none; }
    #patient.active { pointer-events: auto; }
    

提交回复
热议问题