Files
booking/booking.js
Nathan Coad 48d2c4ad32 js fix
2016-06-03 15:05:11 +10:00

18 lines
767 B
JavaScript

/**
* Drupal AJAX framework command.
*/
Drupal.ajax.prototype.commands.bookingAjaxCheckboxes = function(ajax, response, status) {
jQuery(function($) {
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
if ($.inArray($(this).val(), arr) != -1) {
$(this).attr("checked", true);
$(this).closest('tr').addClass("selected");
} else {
$(this).attr("checked", false);
$(this).closest('tr').removeClass("selected");
}
});
});
}