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

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -