But no luck, How can I expand and collapse the accordion/toggle using Javascript? This is a template I am using called Polo (https://inspirothemes.com/polo/index.html)
EDIT: Here’s the issue, the demo isn’t working on the embed. Past the code into a html file and it will work. I want to make ac-item test open and close with Javascript. How can I do that?
Comments
Comment posted by ControlAltDel
JQuery’s show and hide methods essentially add a timer to show() and hide() (along with some nifty animation). If you want to do this in pure JavaScript and/or CSS, just set CSS property to “none” vs. “block”/”inline”
Comment posted by Jack
@ControlAltDel But I would like to also be changing the + and -There’s no way to change the “state” of it as if it was clicked on?
Comment posted by Jack
How can I open and close “test” with a click of a button though is what I am asking?
Comment posted by s.kuznetsov
@Jack, I made the accordion the way you wanted. Check, pls. Or am I missing something from your question?
Comment posted by Jack
Yes, I put an edit in there. The accordion is working, I just need to open and close it with Javascipt, try using the code I posted in a independent HTML file.
Comment posted by s.kuznetsov
@Jack, Do you only need vanilla javascript, or jquery is also allowed?
Comment posted by tony
@Jack So what you’re saying is the accordion you’re using is from a template and it’s working but you just need to open and close it with a javascript call?