Elimination of chaos in a class of nonlinear oscillators