highlight active search filters in green

This commit is contained in:
Oliver Gorwits
2012-01-09 10:58:28 +00:00
parent a0c4c21e61
commit 9e9d408857
3 changed files with 46 additions and 5 deletions

View File

@@ -72,4 +72,36 @@
$(this).parents('.add-on').toggleClass('active', $(this).is(':checked'));
};
$('.add-on :checkbox').each(syncCheckBox).click(syncCheckBox);
// highlight active search filters in green
// there must be a way to factor this out to a func but my JS is weak :-/
$("form .clearfix input").not("[name=q]").each(function() {
if ($(this).val() === "") {
$(this).parent(".clearfix").removeClass('success');
} else {
$(this).parent(".clearfix").addClass('success');
}
});
$("form .clearfix input").not("[name=q]").change(function() {
if ($(this).val() === "") {
$(this).parent(".clearfix").removeClass('success');
} else {
$(this).parent(".clearfix").addClass('success');
}
});
$("form .clearfix select").each(function() {
if ($(this).find(":selected").length === 0) {
$(this).parent(".clearfix").removeClass('success');
} else {
$(this).parent(".clearfix").addClass('success');
}
});
$("form .clearfix select").change(function() {
if ($(this).find(":selected").length === 0) {
$(this).parent(".clearfix").removeClass('success');
} else {
$(this).parent(".clearfix").addClass('success');
}
});
});