javascript - Font awesome icons and toggling -


good afternoon,

i've added font awesome icons website , great. want toggle between fa-angle-up , fa-angle down when user clicks accordion content.

this javascript doing job fine:

$(function() {     $('a').click(function() {         $(this).find('i').toggleclass('fa-angle-down fa-angle-up');     }); }); 

the problem i'm having other icons have been inserted on page within tag toggling show fa-angle- down when click them. one, example, should not toggle:

<i class="fa fa-envelope"></i> 

how can toggle fa-angle icons without toggling other icons in tags?

thank you.

$( "a" ).toggle(function() {   console.log( "first handler .toggle() called." );   $(this).find('i').removeclass('fa-angle-up');   $(this).find('i').addclass('fa-angle-down');   }, function() {   console.log( "second handler .toggle() called." );   $(this).find('i').removeclass('fa-angle-down');   $(this).find('i').addclass('fa-angle-up');   }); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -