0

JavaScript and HTML.

How can i create a JavaScript button in HTML that takes me to another page/section?

30th Nov 2016, 10:23 PM
Vitor Bravo
Vitor Bravo - avatar
2 Respuestas
+ 3
Just add an onclick event to the button: But you shouldn't really have it inline like that, instead, put it in a JS block and give the button an ID: <button id="myButton" class="float-left submit-button" >Home</button> <script type="text/javascript"> document.getElementById("myButton").onclick = function () { location.href = "www.yoursite.com"; }; </script>
30th Nov 2016, 10:36 PM
Hooman Hassanzadeh
Hooman Hassanzadeh - avatar
0
Kambiz thank you so much!!
30th Nov 2016, 10:58 PM
Vitor Bravo
Vitor Bravo - avatar