I have been trying the following:
<form action="/home" class="inline">
<button class="float-left submit-button" >Home</button>
</form>
It seems to work but it goes to the page "/home?"
Is there a better way for me to make a button inside a form make the page go to a new location?
This question is related to
javascript
jquery
html
try
<button onclick="window.location.href='b.php'">Click me</button>
This is here:
<button onClick="window.location='page_name.php';" value="click here" />
Just another variation:
<body>
<button name="redirect" onClick="redirect()">
<script type="text/javascript">
function redirect()
{
var url = "http://www.(url).com";
window.location(url);
}
</script>
you could do so:
<button onclick="location.href='page'">
you could change the action attribute of the form on click the button:
<button class="float-left submit-button" onclick='myFun()'>Home</button>
<script>
myFun(){
$('form').attr('action','new path');
}
</script>
Source: Stackoverflow.com