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