Question: I've needed to do some things on Change event of jQuery Autocomplete. It's working as I expected (doing these things after changing and losing focus). 

However, if I click on submit button or press Enter (that submits too) the Autocomplete Change event is only firing after submit's done and I need it before submitting.

I've already tried some things like trigger change event on submitting event and other palliative things but nothing worked (using Select event is not an option).

Answer: 
If your app only contains one window, or always starts with the same window without even removing it from memory, you can use this code:

```
if let window = NSApp.windows.first {
    window.makeKeyAndOrderFront(self) // Or do something else
}

```

If you need the window during startup of your app, you should load this code async, like this:

```
DispatchQueue.main.async {
    if let window = NSApp.windows.first {
        window.makeKeyAndOrderFront(self)
    }
}

```
Make sure you have a **Window** in your storyboard as *Initial Controller*