js/events: initialize only existing search field

Formlerly JS failed on layouts without menu, should be fixed now.