diff --git a/blocks/contactus/contactus.js b/blocks/contactus/contactus.js index 8333e3f..8cdf7ce 100644 --- a/blocks/contactus/contactus.js +++ b/blocks/contactus/contactus.js @@ -13,18 +13,19 @@ export default function decorate() { let phone = ''; for (let i = 0; i < pTags.length; i += 1) { if (i === 0) { - const ContactUsTitle = pTags[i].outerHTML.replace(/
/g, '
/g, '
/g, ``);
- phone.replace(/<\/p>/g, '');
- pTags[i].innerHTML = `
/g, ''); - innerElements += button.replace(/<\/p>/g, ''); + } else if (i === 2) { + phone = pTags[i].innerText; + const anchor = document.createElement('a'); + anchor.classList.add('phone'); + anchor.setAttribute('href', `tel:${phone}`); + anchor.innerText = phone; + innerElements += anchor.outerHTML; // Use anchor.outerHTML here + } else { + innerElements += pTags[i].outerHTML; } } contactUsDiv.innerHTML = innerElements;