Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p><a id="myAnchor" href="https://johnsmith:smith123@www.example.com">Example link</a></p>

<p>Click the button to change the username part of the link above.</p>

<button onclick="myFunction()">Try it</button>

<p><b>Note:</b> The username property is not supported in Internet Explorer, Safari and Opera version 12 (and earlier).</p>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myAnchor").username = "newUsername";
    document.getElementById("demo").innerHTML = "The username was changed from 'johnsmith' to 'newUsername'.";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com