how to redirect from one page to another in html on button click?

Posted by w3diy - 5 months ago

here Great solution for "how to redirect from one page to another in html on button click?"

js onclick redirect

<button onclick="location.href='www.w3diy.com'">w3diy.com</button>

how to open a new html page on button click in javascript

<button id="w3diyBtn" class="float-left submit-button" >w3diyBtn.com</button>

<script type="text/javascript">
    document.getElementById("w3diyBtn").onclick = function () {
        location.href = "www.w3diy.com";
    };
</script>