forked from M3-Academy/challenge-vtex-io
feat: placeholder do cep pronto e funcionando
This commit is contained in:
parent
d0176b72ea
commit
cbf2a7d744
@ -1,15 +1,27 @@
|
||||
import React from "react";
|
||||
|
||||
const PlaceholderCep = () => {
|
||||
new Promise(resolve => {
|
||||
if (document.querySelectorAll(".vtex-address-form-4-x-input").length > 0) {
|
||||
return resolve(Array.from(document.querySelectorAll(".vtex-address-form-4-x-input")));
|
||||
}
|
||||
|
||||
if (typeof document !== "undefined") {
|
||||
const observer = new MutationObserver(() => {
|
||||
if (document.querySelectorAll(".vtex-address-form-4-x-input").length > 0) {
|
||||
resolve(document.querySelectorAll(".vtex-address-form-4-x-input"));
|
||||
observer.disconnect();
|
||||
}
|
||||
});
|
||||
|
||||
// document.getElementsByClassName("vtex-address-form-4-x-hideDecorators")[0].setAttribute("placeholder", "Digite seu CEP");
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
}).then((els: any) => {
|
||||
els[0].placeholder = "Digite seu CEP";
|
||||
});
|
||||
|
||||
// .placeholder = "Digite seu CEP"
|
||||
|
||||
};
|
||||
|
||||
return "" ;
|
||||
return <></>;
|
||||
};
|
||||
|
||||
export default PlaceholderCep;
|
Loading…
Reference in New Issue
Block a user