This might be enough if placed inside the widget. No other script necessary. Wrap in a function if it needs to be reused / used for an update.