Button load state Bootstrap

0

I'm having trouble with Bootstrap 3.3.7

<a href="#">
    <button type="button" class="btn btn-danger" data-loading-text="Aguarde..." id="myButton">
        Entrar
    </button>
</a>

I click and it does not load, my script looks like this:

<script>
  $('#myButton').on('click', function () {
    var $btn = $(this).button('loading')
    // business logic...
    $btn.button('reset')
  })
</script>
    
asked by anonymous 23.05.2017 / 18:15

1 answer

0

The answer to your question is HERE

But come on, I'll transfer you here.

"You need to detect the click of the js side, your HTML remaining the same:"

$("button").click(function() {
    var $btn = $(this);
    $btn.button('loading');
    // simulating a timeout
    setTimeout(function () {
        $btn.button('reset');
    }, 1000);
});

Also, do not forget to load jQuery and Bootstrap js (jQuery-based) file into your page.

Also use the following:

<button type="button" data-loading-text="Carregando..." class="btn btn-primary">
  Loading state
</button>
    
23.05.2017 / 18:18