Form keydown event error

In the search condition form, there is an entry called search term. In this form, a keydown event is declared. If you enter a value in the search term and press Enter, you must output the value entered in the search term. But it returns an empty value at the beginning. What did you do without fixing this?

The input’s value updates only after the blurring out of the input, so you should try to blur() the input before getting its value.
Here is the updated snippet: