challenge-vtex-io-bernardo-.../react/components/Placeholder/index.tsx

19 lines
445 B
TypeScript
Raw Permalink Normal View History

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