Ubah Kondisi Elemen Induk Kalau Checkbox Dicentang (Checked) - Dewa Blogger

Halaman

    Social Items

Buy Now
Add Class to Parent if CkeckBox is Checked Ubah Kondisi Elemen Induk Jika CheckBox Dicentang (Checked)

jQuery

$('div.area').find('input:checkbox').change(function() {     if ($(this).is(':checked')) {         $(this).parent().addClass('active');     } else {         $(this).parent().removeClass('active');     } });

CSS

.area {   padding:10px;   border:1px solid #ccc; }  .active {background-color:yellow}

Lihat Demo

Thank’s Mottie :D


Sumber https://www.dte.web.id/

Ubah Kondisi Elemen Induk Kalau Checkbox Dicentang (Checked)

Add Class to Parent if CkeckBox is Checked Ubah Kondisi Elemen Induk Jika CheckBox Dicentang (Checked)

jQuery

$('div.area').find('input:checkbox').change(function() {     if ($(this).is(':checked')) {         $(this).parent().addClass('active');     } else {         $(this).parent().removeClass('active');     } });

CSS

.area {   padding:10px;   border:1px solid #ccc; }  .active {background-color:yellow}

Lihat Demo

Thank’s Mottie :D


Sumber https://www.dte.web.id/