javascript - How to toggle font awesome icon on click? -


I am using the Font Awesome 'Plus' icon on list items of expandable categories when they are in extended state I have a 'zero' symbol '

HTML

    

Jquery

  $ ('# category-tab took one'). Click (function () {$ (this) .next ('ul') Slide Toggle ('500');});   

Enter image details here

You can change the class of i element within the click code

 < Code> & lt; I class = "fa-plus-circle" & gt; & Lt; / I & gt;   

then

  $ ('# category-tabs li a'). Click (function) ($ (this) .next ('ul'). Slide Toggle ('500'); $ (this) .Find ('I'). ToggleClass ('FA-Plus-Circle FA-Minus- Circle')});   

Demo:

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -