update js to add/remove selected class
This commit is contained in:
@@ -6,7 +6,13 @@ Drupal.ajax.prototype.commands.bookingAjaxCheckboxes = function(ajax, response,
|
||||
var arr = $.parseJSON($('input#' + response.formDataElement).val())
|
||||
$('#' + response.formName).find(':checkbox[name^="' + response.checkboxName + '"]').each(function () {
|
||||
//.prop() doesn't exist in Drupal's old version of jQuery so use .attr() instead
|
||||
$(this).attr("checked", ($.inArray($(this).val(), arr) != -1));
|
||||
if ($.inArray($(this).val(), arr) != -1) {
|
||||
$(this).attr("checked", "true");
|
||||
$(this).addClass("selected");
|
||||
} else {
|
||||
$(this).attr("checked", "false");
|
||||
$(this).removeClass("selected");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user