This will work for most simple controls. More complex controls, such as the ones in jqWidgets, will need more intervention.