I want to create a script that changes the href of a button only if it contains a link or a period, since URLs normally contain periods (if it contains a link, I want to replace it with another one, for example google.com). However, the script I have changes all hrefs regardless of their content.
<script>
window.onload = function() {
var anchors = document.getElementsByClassName("elementor-button");
for (var i = 0; i < anchors.length; i++) {
anchors[i].href = "https://google.com"
}
}
</script>