html - How do I get Jquery to toggle display -


I am creating a FAQ page that displays for the answer.

Here is Jquery

  $ (document) .ready (function () {$ ('. Faqlink'). Click (function () {$ ('. Hide (FIP) '). Hide (); $ (this) .next (' hidden FAQ '). Show ();});});   

css

  .hiddenFAQ {display: none; }   

and HTML

  & lt; One class = "faqlink" href = "#" & gt; Link 1 & lt; / A & gt; & Lt; div class = "hidden FAQ" & gt; & Lt; P & gt; Larem ipsum & lt; / P & gt; & Lt; / Div & gt;   

It will appear now, but the only way to remove it is to refresh the page. How do I create a toggle instead? Thanks

Use instead:

  $ (document). Click (function () ($ ('. Faqlink'). (Function () {$ (this) .next ('hidden'). Toggle ();});});   



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -