gexxos
1
Hi to all, I want a Creative Commons license on the footer of my blog, in my site’s code injection I enter the following
<script>
document.addEventListener('DOMContentLoaded', function() {
const copyrightElement = document.querySelector('.gh-copyright');
if (copyrightElement) {
copyrightElement.textContent ='CC BY-SA 4.0';
}
});
</script>
How can I make the text to link with the official license page?
Thanks in advance
jannis
2
You’d just need a slightly different code that not only changes the text content, but the entire HTML node
<script>
document.addEventListener('DOMContentLoaded', function() {
const copyrightElement = document.querySelector('.gh-copyright');
if (copyrightElement) {
copyrightElement.innerHTML = '<a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="noopener noreferrer">CC BY-SA 4.0</a>';
}
});
</script>
1 Like
gexxos
3
Jannis, I have no words, my friend, I appreciate your help all these times, Thank you I learned something from you today.
3 Likes
jannis
4
Absolute pleasure – glad this helps you with your site
2 Likes