How to assign values to Bootstrap buttons

Asked

Viewed 567 times

1

Bootstrap (how to do the menu bar by assigning values to buttons. .ex.: I created the "Home" button, as I can assign a value to it for when I access it I go to the home button page...)

  • 2

    Can you explain your question better? It’s unclear.

  • 2

    Thus? <a href="inicio.html" class="btn btn-primary" role="button">Início</a>

3 answers

1

The classes btn and btn-* can be used both in Buttons (<button>) as links (<a>):

<button class="btn btn-primary" id="botao">Botão</button>

<a href="https://www.google.com/" class="btn btn-primary">Link</a>

If you use the <button> you have to use Javascript/jQuery to change the location as explained by @pnet.

See here: http://jsfiddle.net/B8L77/

You can see the official documentation about buttons here.

0

You can create for example:

<a href="#"><button type="button" class="btn btn-default">Inicio</button></a>

You can also see examples of using links and buttons here for example

http://getbootstrap.com/components/#navbar

Other mode and using javascript or jquery and onclicked.

0

You can also create a function in jquery that calls your page and on the button call that function like this:

Jquery:

function chamaInicio(){
   $(window.document.location).attr('href','url_da_sua_pagina_completo_aqui');
}

And here’s the call on your button

<input id="btnChamaInicio" type="button" class="btn btn-success col-md-1" value="Inicio" onclick=" return chamaInicio();" />

Test and put the result.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.