javascript - How can I make a button redirect my page to another page? -


this question has answer here:

i have been trying following:

<form action="/home" class="inline">     <button class="float-left submit-button" >home</button> </form> 

it seems work goes page "/home?"

is there better way me make button inside form make page go new location?

just add onclick event button:

<button onclick="location.href = 'www.yoursite.com';" id="mybutton" class="float-left submit-button" >home</button> 

but shouldn't have inline that, instead, put in js block , give button 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> 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -