here try change class attribute. failed. how toggle class value.
<button id="mybt" class="fa fa-plus"></button> <script> $("#mybt").click(function() { $("#mybt").toggleclass("fa fa-minus"); }); </script>
you should specific while using selectors. if wanting toggle fa-plus fa-minus should use class name in jquery selector.
also should remove existing css class show '+' icon , add css class show '-' icon.
$("#mybt").click(function(){ $("#mybt").toggleclass("fa-plus"); $("#mybt").toggleclass("fa-minus"); }); my solution above problem http://jsfiddle.net/u654oco8/3/ check out
Comments
Post a Comment