Check all checkboxes in field

I’m trying to check all the checkboxes in a form input:

$("input[name*='x_FIELD_NAME']").each(function() { //loop through each checkbox
	this.checked = true;
});

This does check the boxes in the browser window, but when I save, it doesn’t save the values into the database record.
How should I do it?

You better call .click() so the handlers will be triggered.

That works. Thanks!