Completed search by ID feature and separated js code