0

I have a problem here which I want to click button then go to another page. But it does not function

This is my code

<button type="button" class="btn btn-edit btn-sm pull-right" data-toggle="modal" data-target="#modal-editProfile" href="template/home.html">Start Booking Your Room</button>

I do not know why, the button does not function. please help me, I have wasted my whole day just doing this.

Thanks, faizal

Tarabass
  • 3,132
  • 2
  • 17
  • 35
Dong
  • 21
  • 1
  • 11

2 Answers2

1

HTML

The plain HTML way is to put it in a <form> wherein you specify the desired target URL in the action attribute.

<form action="http://google.com">
    <input type="submit" value="Go to Google">
</form>

Set if necessary CSS display: inline; on the form to keep it in the flow with the surrounding text.

CSS

If CSS is allowed, simply use an <a> which you style to look like a button using among others the appearance property (only IE support is currently (July 2015) still poor).

<a href="http://google.com" class="button">Go to Google</a>
a.button {
    -webkit-appearance: button;
    -moz-appearance: button;
    appearance: button;

    text-decoration: none;
    color: initial;
}

Or pick one of those many CSS libraries like Bootstrap.

JS

If JavaScript is allowed, set the window.location.href.

<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />

Source

Community
  • 1
  • 1
Tarabass
  • 3,132
  • 2
  • 17
  • 35
0

Buttons won't redirect you to another page unless you handle that in javascript. If you just want to redirect, you may use anchor tag, see example below:

<a class="btn btn-edit btn-sm pull-right" href="template/home.html">Start Booking Your Room</a>
kamal pal
  • 4,187
  • 5
  • 25
  • 40