Answers for "a href link change"

1

changeable href

<input id="input" type="url"></input>
<button id="link button"><a id="link" style="text-decoration: none; color: inherit;" href="" TARGET="_BLANK">enter</a></button>
<script src="script.js">
    var linkButton = document.getElementById("link button")
    linkButton.onclick = function(){
        var input = document.getElementById("input").value
        document.getElementById("link").setAttribute("href", "http://"+input)
    }
</script>
Posted by: Guest on October-16-2020

Browse Popular Code Answers by Language