Fixed javascript bug

It was nor removing spaces, variable edit1 was duplicated