Estoy tratando de redirigir a un enlace cuando se hace clic en el botón, pero no funciona, necesito un código que funcione, por favor.
function myFunction() { document.getElementById("mycom").location.href = "http://mywebsite.com/home.html""; } <button type="button" onclick="myFunction()">Try it</button>Para redirigir, cambie su función a lo siguiente:
function myFunction() { window.location = 'http://mywebsite.com/home.html' }