2

Good Day

I am using an ASP.NET webform where I have wrapped the following button inside the form tags:

<form runat="server">

  <button class="btn btn-primary" onclick="window.location='http://google.co.za';">Login</button>

</form>

ISSUE: The problem is that when clicking on the button, it just directs to the current page...does not redirect. However, when I remove the form tags, the button works. If I leave the form tags and I use an anchor tag to relocate, it works as well...It is just the button that is giving me issues.

Why is that?

I am using Twitter bootstrap as well(extra info..)

Thank you

1 Answer 1

11

Add type="button" attribute to your button tag. Without it button works as submit.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.