button href not working

时间:2017-04-08 22:31:02

标签: javascript html css

<a href="signUp.html"><button type="submit" class="btn btn-primary submitSignUp" >Sign Up</button></a>

Why does this not work? I have a different page called signUp and on-click of the sign-up button, I want it to go to the signUp page.

2 个答案:

答案 0 :(得分:5)

You should not place <button> inside <a> element as <button> consumes mouse events preventing <a> element click generation.

So try just this

<a href="signUp.html" class="btn btn-primary submitSignUp">Sign Up</a>

答案 1 :(得分:0)

to have the same result I would suggest you to change your code to this:

<a class="btn btn-primary submitSignUp" href="signUp.html">Sign Up</a>