JSFiddle - React, Tailwind, and code Playground
by nobuts
HTML
<p class="phone">2124771000</p>
JavaScript
$(".phone").text(function(i, text) {
text = text.replace(/(\d{3})(\d{3})(\d{4})/, "+66 $1-$2-$3");
return text;
});
by nobuts
<p class="phone">2124771000</p>
$(".phone").text(function(i, text) {
text = text.replace(/(\d{3})(\d{3})(\d{4})/, "+66 $1-$2-$3");
return text;
});