challenge-vtex-io-ana-carol.../react/components/Placeholder/Placeholder.tsx

18 lines
469 B
TypeScript
Raw Normal View History

const Placeholder = () => {
if (typeof document !== "undefined") {
const postalCodeInput = document.querySelector(
".vtex-address-form-4-x-input"
);
const postalCodeValue = document.querySelector(".postalCode");
if (postalCodeInput) {
postalCodeInput.classList.add("postalCode");
}
if (postalCodeValue) {
postalCodeValue.setAttribute("placeholder", "Digite seu CEP");
}
}
return null;
};
export default Placeholder;