Prevent checkbox from ticking/checking COMPLETELY

前端 未结 13 536
醉梦人生
醉梦人生 2020-12-09 07:48

I have been asked to disable the \"ticking\" of a checkbox. I am not being asked to disable the checkbox, but to simply disable the \"ticking\".

In other w

相关标签:
13条回答
  • 2020-12-09 08:21

    Simply revert the value back

    $('input[type="checkbox"]').on('change', function(e) {
        if (new Date().getDate() === 13) {
            $(this).prop('checked', !$(this).prop('checked'));
            e.preventDefault();
            return false;
         }
         // some code here
    });
    
    0 讨论(0)
提交回复
热议问题