// validate phone
let billingPhone = document.querySelector("#billing_phone");
const maskPhone = () => {
billingPhone.addEventListener("click", (e) => {
console.log("billingPhone", e.target.value);
const phoneMask = IMask(billingPhone, {
mask: "{+7} (#00) -000-00-00",
definitions: {
"#": /[01234569]/,
},
lazy: false,
placeholderChar: " ",
});
});
};
maskPhone();
}, 2000);
<input type="text" value="hello world" onclick="setCursor(event)">
const setCursor = (e) => {
const input = e.target
input.focus();
input.setSelectionRange(0, 0);
}