I have written this code with the help of CSS and JQuery. The CSS sets the initial styling and also changes the “+” and “-” symbol based on the state of the accordion. These days jquery accordion has become a part of many frameworks like bootstrap. But in websites where we need to write stand alone accordion this code will be helpful.
You are free to use the same exact code or modify to your need.
PS: I have used variables for all the CSS selector in the jQuery. This will be especially be useful when you want to edit the code based on your HTML dom.