Rabu, 28 Desember 2011

Ubah Kondisi Elemen Induk Jika CheckBox Dicentang (Checked)

JQuery Snippets

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;}


Thank's Mottie :D

Tidak ada komentar:

Posting Komentar