How to allow only a few numbers in the product description,

  • Welcome to Babiato Forum! All Resources are 100% clean and Safe to Use

asdriel

Member
Apr 26, 2019
198
17
18
www.bantu-2rsn.com
Hello guys, I have this code to allow only a few numbers in the product description, but it doesn't work, any help?

I intend to allow only 5 or 4 numbers in the product description
whether or not to allow the number to start with 9


jQuery(document).ready(function() {mudarPhone();});
jQuery(document).load(function() {mudarPhone();});
let box = document.querySelector('.product-modal-content');

function mudarPhone() {
var textoAntigoDaDescricao = document.querySelectorAll('.woocommerce-product-details__short-description');
for (let i = 0; i < textoAntigoDaDescricao.length; i++) {
var formatodophone1 = /([0-9]{3})\)?[ - ]?([0-9]{3})[ - ]?([0-9]{3})/g;
var formatodophone2 = /([0-9]{3})\)?[ - ]?/g;
textoAntigo = textoAntigoDaDescricao.innerHTML;
textoAntigo = textoAntigo.replace(formatodophone1, "9xx xxx xxx");
textoAntigo = textoAntigo.replace(formatodophone2, "9xx");

textoAntigoDaDescricao.innerHTML = textoAntigo;

}
}
 

About us

  • Babiato Forum - The webmaster community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day, updating Daily resource to make sure our community is one of the best.

Quick Navigation

User Menu