How would one put a link on a button with bootstrap?
there are 4 methods in the bootstrap documentation:
<a href="#" class="btn btn-info" role="button">Link Button</a>
<button type="button" class="btn btn-info">Button</button>
<input type="button" class="btn btn-info" value="Input Button">
<input type="submit" class="btn btn-info" value="Submit Button">
The first one doesn't work for me, no button shows, just the text with the link, have a feeling its the theme im using.
The second one shows the button which is what i want, but whats the code make the button link to another page when clicked?
Cheers
You can call a function on click event of button.
OR Use this Code
Another trick to get the link color working correctly inside the
<button>
markupPlease keep in mind that in bs4 beta e.g.
btn-primary-outline
changed tobtn-outline-primary
If you don't really need the button element, just move the classes to a regular link:
Conversely, you can also change a button to appear like a link:
The easiest solution is the first one of your examples:
The reason it's not working for you is most likely, as your say, a problem in the theme you're using. There is no reason to resort to bloated extra markup or inline Javascript for this.
This is how I solved
Combining the above answers i find a simply solution that probably will help you too:
by just adding inline JS code you can transform a button in a link and keeping his design.