jquery - Bootstrap - data-toggle attribute when multiple buttons exist -


i have several buttons. when user clicks button want give him impression button clicked .

this code:

<table> <thead> <tr> <th><button class="btn btn-danger" >today</button></th> <th><button class="btn btn-danger" >tomorrow</button></th> <th><button class="btn btn-danger" >dayaftertomorrow</button></th> </tr> </thead> </table> 

and works when have single button:

<button class="btn" data-toggle="button">today</button> 

if user clicks on tomorrow, data-toggle attribute still remains today button. instead, want disable data-toggle attribute when button clicked.

you can use bootstraps radio button functionality achieve effect. try this:

<div data-toggle="buttons-radio"> <button class="btn btn-danger">today</button> <button class="btn btn-danger">tomorrow</button> <button class="btn btn-danger">dayaftertomorrow</button> </div> 

demo: http://jsfiddle.net/u7lg8/


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -