John Magnolia
John Magnolia

Reputation: 16793

Bootstrap button reset

Click the Default button to add active class but why is the reset button not resetting the button state?

$('#reset').click(function(){
    $('#test').button('reset');
})

HTML

<p>
<button id="test" type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false" autocomplete="off">Default</button>
</p>
<p>
<button id="reset">
Reset
</button>
</p>

Example: http://jsfiddle.net/rdh579hc/1/

Upvotes: 1

Views: 6188

Answers (1)

Quentin Roger
Quentin Roger

Reputation: 6538

You can do that to reset your button :

$('#reset').click(function() {
  var button = $('#test');
  button.attr('aria-pressed', "false");
  button.removeClass('active');
})

http://jsfiddle.net/gpfb7xeu/

Upvotes: 1

Related Questions