How to assign arbitrary data to a dialog?

How to assign arbitrary data to a dialog?

I am making a simple dialog with a multi-select input in it.
The dialog will have a Cancel and Apply button (apply will cause a grid to be filtered based on the values in the multi-select).

When the user pops up the dialog, they may change the values in the multi-select and Cancel.  This will preserve the values and they won't accurately reflect what the grid is currently filtered by.  I want to restore the values that were selected in the SELECT if they hit Cancel.

I'm thinking the way to do that is to get the .val() of the SELECT and store them on the dialog so the Cancel button's event handler can get them and re-apply them to the SELECT.

How best to do this?