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

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -