Add strikethrough to checked checkbox

后端 未结 6 1050
时光说笑
时光说笑 2021-02-13 23:57

I am trying to add strikethrough when i select a checkbox in my form (Bootstrap v3). I coded this bootply:

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-14 00:22

    jQuery solution:

    $('#packersOff').change(function() {
      if ($('#packersOff').prop('checked') ) {
        $('#test').css('text-decoration','line-through');
      }
    });
    
    

提交回复
热议问题