Select2 helper function is a good idea. But I think it would be much better to pass the function the original name of the element instead of the fake name of the autogenerated select2 element as that id is very likely to change. Finding the select2 element given the original name should just be a matter of traversing dom siblings.