Add strikethrough to checked checkbox

yaylitzis

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

<div class="form-group ">
    <label for="inputName" class="col-md-1 control-label">select</label>  
    <div class="col-md-5">
        <div class="checkbox">
             <label><input type="checkbox" name="packersOff" class="strikethrough" value="1">sssssssss</label>
        </div>
     </div>
</div>

and added a class in css

.strikethrough:checked{
  text-decoration:line-through;
}

but it doesn't work..

Andrew

Here is a solution to put a strike through when your input is checked:

input[type=checkbox]:checked + label.strikethrough{
  text-decoration: line-through;
}
<div class="form-group ">
    <label for="inputName" class="col-md-1 control-label">select</label>  
    <div class="col-md-5">
        <div class="checkbox">
            <input type="checkbox" name="packersOff" id="packers" value="1"/>
            <label for="packers" class="strikethrough">sssssssss</label>
        </div>
     </div>
</div>

JSFIDDLE

With this solution when ever the checkbox is checked it will do something to the label. so you could make it bold or change its colour if you wanted.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Add css If checkbox checked?

From Dev

Add "checked' property to checkbox in jquery

From Dev

Add "checked' property to checkbox in jquery

From Dev

Javascript add value if checkbox is checked

From Java

How to add required validation to matInput if the checkbox is checked

From Dev

Add WHERE to PDO query if checkbox is checked

From Dev

javascript add checkbox-checked values

From Dev

Add value to JavaScript variable when checkbox is checked

From Dev

If checkbox is checked add class to it's label

From Dev

Keyup: add a value when a checkbox is checked

From Dev

React checkbox if checked add value to array

From Dev

add onto checked values in checkbox via jquery

From Dev

Knockout: add textpath only if checkbox is checked

From Dev

how to add edittext when checkbox is checked

From Dev

Add WHERE to PDO query if checkbox is checked

From Dev

Keyup: add a value when a checkbox is checked

From Dev

Add/remove form element depending on if checkbox is checked

From Dev

Add/Remove class if checkbox is checked/unchecked (AngularJS)

From Dev

Checkbox not checked

From Dev

How to add the 'checked' status of an input checkbox to be sent through email?

From Dev

jQuery. Check onload if checkbox is checked and add css to div

From Dev

Angular material checkbox - add function to ng-checked

From Dev

Drupal Content Type: how to add a checkbox that hides an object if checked?

From Dev

Angular material checkbox - add function to ng-checked

From Dev

Add class and change inner HTML when checkbox is checked

From Dev

javascript add checkbox-checked values with the use of custom attribute

From Dev

MVC6 - if(checkbox ticked) then strikethrough

From Dev

PHP checkbox validation checked or not checked

From Dev

Get checkbox values on checked and not checked

Related Related

  1. 1

    Add css If checkbox checked?

  2. 2

    Add "checked' property to checkbox in jquery

  3. 3

    Add "checked' property to checkbox in jquery

  4. 4

    Javascript add value if checkbox is checked

  5. 5

    How to add required validation to matInput if the checkbox is checked

  6. 6

    Add WHERE to PDO query if checkbox is checked

  7. 7

    javascript add checkbox-checked values

  8. 8

    Add value to JavaScript variable when checkbox is checked

  9. 9

    If checkbox is checked add class to it's label

  10. 10

    Keyup: add a value when a checkbox is checked

  11. 11

    React checkbox if checked add value to array

  12. 12

    add onto checked values in checkbox via jquery

  13. 13

    Knockout: add textpath only if checkbox is checked

  14. 14

    how to add edittext when checkbox is checked

  15. 15

    Add WHERE to PDO query if checkbox is checked

  16. 16

    Keyup: add a value when a checkbox is checked

  17. 17

    Add/remove form element depending on if checkbox is checked

  18. 18

    Add/Remove class if checkbox is checked/unchecked (AngularJS)

  19. 19

    Checkbox not checked

  20. 20

    How to add the 'checked' status of an input checkbox to be sent through email?

  21. 21

    jQuery. Check onload if checkbox is checked and add css to div

  22. 22

    Angular material checkbox - add function to ng-checked

  23. 23

    Drupal Content Type: how to add a checkbox that hides an object if checked?

  24. 24

    Angular material checkbox - add function to ng-checked

  25. 25

    Add class and change inner HTML when checkbox is checked

  26. 26

    javascript add checkbox-checked values with the use of custom attribute

  27. 27

    MVC6 - if(checkbox ticked) then strikethrough

  28. 28

    PHP checkbox validation checked or not checked

  29. 29

    Get checkbox values on checked and not checked

HotTag

Archive