Answer the question
In order to leave comments, you need to log in
How to make changing numbers and make them both work?
There is not enough space in the header to insert 2 numbers, so I would like to make it so that the number is displayed, but only mobile operators change (the numbers are identical, only the operators differ), how can this be implemented, and so that both numbers would work correctly?
Answer the question
In order to leave comments, you need to log in
<a id="phone" href=""><a/>
document.addEventListener('DOMContentLoaded', function() {
var link = document.getElementById('phone');
var a = '+7(123) 123-45-67';
var b = '+8(321) 123-45-67';
link.innerText = b;
link.setAttribute('href', 'tel:' + b);
setInterval(function() {
link.innerText = link.innerText === b ? a : b;
link.setAttribute('href', 'tel:' + link.innerText);
}, 1000);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question