You can select the elements in the cross-page list, then filter using the in-page list:
var chkBoxes = $("#" + idContainerArray.join(",#")); chkBoxes = chkBoxes.filter("#" + idArray.join(",#")); chkBoxes.prop("checked", true);
You may be able to omit the filter. Is it possible for an element that is contained in idContainerArray to be used as an id on the current page, but not be contained in idArray? Because, if not, you can skip the filter and just do this:
$("#" + idContainerArray.join(",#")).prop("checked", true);
This works even if the id is reused as something other than a checkbox. The checked property won't hurt or have any side effects if it is written to a non-checkbox element. If the id can be reused, but not as a checkbox, and you don't want to write the checked property, you can filter out the non-checkboxes:
$("#" + idContainerArray.join(",#")).filter(":checkbox").prop("checked", true);
Or:
$("#" + idContainerArray.join("[type=checkbox],#") + "[type=checkbox]").prop("checked", true);
This second technique that does not use jQuery's :checkbox shorthand might be a hair faster because it will take advantage of the browser's native querySelectorAll() call. On most pages, you wouldn't notice a difference though.