  In this paper, we extend a spherical variant of the Kowalski-S\{l}odkowski
theorem due to Li, Peralta, Wang and Wang. As a corollary, we prove that every
2-local map in the set of all surjective isometries (without assuming
linearity) on a certain function space is in fact a surjective isometry. This
gives an affirmative answer to the problem on 2-local isometries posed by
Moln\'ar.
