bios
bios

Reputation: 299

Bootstrap chevron icon doesn't change onclick, why?

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??

Upvotes: 3

Views: 2501

Answers (1)

Getz
Getz

Reputation: 4063

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);
});

Upvotes: 1

Related Questions