I have the following html in a footer div:
<span itemprop="telephone"><a href="tel:01 XX XX XX XX">01 XX XX XX XX</a></span>
I want to dynamically change the phone number within this span. 2 issues there:
span is using microformats data so I cannot based my find on itemprop but I need to base it by using telephone I guess?
I can udpate 01 XX XX XX XX embedded between the tags but what about the href value?
Anyone could help?
I've tried this which is not working
function getPhone() {
var span = $('.wcb_row2');
if (!span.length) return;
return $('.wcb_row2').find('a');
}
function replacenumber(num) {
if( num == 'undefined' || num== null )
return;
var newnum = getPhone();
(newnum.html( newnum.html().replace(/tel:*[ ]*\d{2}[ ]\d{2}[ ]\d{2}[ ]\d{2}[ ]\d{2}/, 'tel: ' + num) ))
}
replacenumber( num);