I'm trying to hide and show paragraph's on a FAQ page. The paragraphs are hidden initially, and I add the following code:
$(document).ready(function() {
$('h3').click(function() {$(this).next("p").toggleClass("unhidden-paragraph") } )
})
unhidden-paragraph
styles it to show the paragraph. So if one clicks on a question (h3
) then it shows the paragraph.
This works perfectly, however when I go to a different page on squarespace and then use the back button to my FAQ page. Then the ready
is not called again and clicking on the h3
questions no longer works.