N
N
nsrwork2014-05-05 12:38:40
JavaScript
nsrwork, 2014-05-05 12:38:40

Why is attr not added when working with standard bootstrap button() function?

When you click on the "Update" button, the inscription changes to "Updating ..." then a request is sent and, if successful, the inscription changes to "Done!"

<button id="loading-example-btn" type="button" 
data-loading-text="Обновляю..." 
data-complete-text="Готово!">Обновить</button>

<script>
  $('#loading-example-btn').click(function () {
    var btn = $(this)
    btn.button('loading')
        $.post("/csrf/profile", function(data) {
            if (data) {     
                // вот здесь attr не добавляется, почему не могу понят ((
                // т.е. btn.button('complete') проходит нормально, а дальше нет
                btn.button('complete').attr('disabled');
            } 
        });
  });
</script>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Melnikov, 2014-05-05
@mlnkv

have you tried like this
:
Nothing has changed, right?
Right
either
el.attr("disabled", true);

L
lnked, 2014-05-05
@lnked

what if you try it like this?
$('#loading-example-btn').prop('disabled', true);

A
Andrew, 2014-05-06
@goodmind

btn.button('complete').end()
   .attr('disabled')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question