w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
closing open divs in jQuery accordian plugin before opening the one clicked on

I think you should <div></div> your entire set of accordion, instead of calling function for each element.

than either use data- on each link to select which sections to open. ( or use .next("p"))

This way you have a wrapper and now u can simply call .children("p").hide(); before opening one.

Edit: If you must go with using variable and boolean expression, look into sessionStorage.

probably something like sessionStorage.accordion_current = "#"+openAndCloseArea.id

and $(sessionStorage.accordion_current).hide();

note you need supported browser.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.