123456789101112131415161718 |
- /**
- * State has already changed when this handler is called.
- *
- * @param event
- */
- function handleCheckboxClick(event) {
- var $target = $(event.target);
- var currentState = $target.prop("checked");
- var $item = $($target.parentsUntil("ul")[2]);
- var newClass = currentState ? "list-group-item-success" : "list-group-item-warning";
- var oldClass = currentState ? "list-group-item-warning" : "list-group-item-success";
- console.log($item.constructor.prototype);
- $item.addClass(newClass).removeClass(oldClass);
- }
- $(function () {
- $("input[type='checkbox']").click(handleCheckboxClick);
- });
|