A first-order transition in the charge-induced conformational changes of polymers