A Pen by Huseyin Yilmaz on CodePen.
Created
January 23, 2019 17:23
-
-
Save huseyinyilmaz/daa21e359753ca849e4446f54d01580d to your computer and use it in GitHub Desktop.
VgYPgV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<div class="givva" data-uid="23179deb-2160-0f01-986d-c9cd54c163cd"></div> | |
<body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener( | |
"DOMContentLoaded", | |
() => { | |
const el = document.querySelector('.givva'); | |
if (!el) { | |
console.log('Cannot find root element with .givva class'); | |
} else { | |
const uid = el.getAttribute('data-uid'); | |
if (!uid) { | |
console.log('Element with .givva class do not have data-uid attribute.'); | |
} else { | |
el.innerHTML = ('uid found: ' + uid); | |
console.log('Write completed successfully'); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.givva { | |
background-color: blue; | |
color: white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment