3

I have this section:

<div id="weather">
<h4><i class="icon-chevron-down"></i> Weather</h4>

and code to this:

$('#weather h4').click(function (){
    $('#weather .entries').toggle();
    $('#weather .icon-chevron-down').toggleClass('icon-chevron-right');
});

jsbin1

and it doesn't work, but if I change places for icon-chevron, it works:

jsbin2

is it a bug or am I doing something wrong??

madth3
  • 7,151
  • 12
  • 47
  • 72
bios
  • 211
  • 5
  • 16
  • try .toggleClass("icon-chevron-right icon-chevron-down") note, that you have to change the selector in front of toggleClass ;-) – DeBaum Apr 25 '13 at 09:54
  • Similar: http://stackoverflow.com/questions/19024218/bootstrap-3-collapse-change-chevron-icon-on-click/20925245#20925245 – trante Jan 04 '14 at 18:54

1 Answers1

1

This one is working:

http://jsbin.com/omerep/1/edit

$('#weather h4').click(function (){
    $('#weather .entries').toggle();
    $(this).find('i').toggleClass('icon-chevron-right icon-chevron-down', 200);
});
Getz
  • 3,914
  • 6
  • 34
  • 52