Process search input in JS