<p username="Grepper" id="element"></p> <script> Username = document.getElementById("element").getAttribute("username") console.log(Username) // "Grepper" </script>