jQuery attr() not working on Bootstrap button after reset -


i have simple code doesn't work , don't understand i'm missing.

external resources

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> 

html

<p>     <button id="btn-id" class="btn btn-large btn-primary" type="button" data-loading-text="loading stuff...">click me</button> </p> 

javascript

$(document).ready(function () {     $("#btn-id").button();      $("#btn-id").click(function () {         //$("#btn-id").attr("disabled",true);         $(this).button('loading');          settimeout(function () {             //this desn't work. button resets doesn't disabled afterwards             $("#btn-id").button('reset').attr("disabled", true);              //the bellow line works expected             //$("#btn-id").button('reset').addclass("btn-success");         }, 2000);     }); }); 

it seems after button('reset'), can addclass('someclass') can't disable button anymore.

why not working , how can fix it?

jsfiddle

not sure if right way, can use workaround

$(document).ready(function () {     $("#btn-id").button();      $("#btn-id").click(function () {         $(this).button('loading');         settimeout(function () {             $("#btn-id").addclass('btn-success').data('loading-text', 'ok').button('loading')         }, 2000);     }); }); 

fiddle


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -