javascript - Dynamically changing an icon in Twitter Bootstrap 3 -


take here (it uses jquery, knockoutjs, twitter bootstrap 3):

http://jsfiddle.net/ncufy/3/

<i class="glyphicon" data-bind="click: function() { ispaused(!ispaused()) }, css: {'glyphicon-play': ispaused(), '.glyphicon-pause': !ispaused()}"></i>  var viewmodel = {     ispaused: ko.observable(true), };  ko.applybindings(viewmodel); 

when click on play icon, icon disappears. instead, icon should turn pause icon. wrong? use latest chrome.

you have . in front of glyphicon-pause. remove it

demo: http://jsfiddle.net/tymejv/ncufy/4/

css: {'glyphicon-play': ispaused(), '.glyphicon-pause': !ispaused()}                                      ^ dont belong there!! 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -