• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Hello Guys, Any Help please

asdriel

Member
Apr 26, 2019
199
18
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;

}
}
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock