java script collapsible

Hi - I wrote the following php code and now I want to add collapsible function to this.
I am not sure how to add it.

when I run the attached php program (ee.txt) the output will be something like this.

Customer Oriented
   Another Process
   process 1

Support
    4th process
    3rd Process

Management
     Control of Documents
     Sales
     some process


but I want all this to be collapsible because the number of processes may be more...
so i want output like below
+Customer Oriented
+Support
+Management
when i click on + i want to see the list.

How can change the attached php to do that.
generally in html I use data-role="collapsible"
but here when i used i got errors.

Thanks
ee.txt
expertexchange.PNG
shragiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrunalCommented:
hi
In simple way thinking you can write css class and add class when page is getting loaded and on click (+) sign you can toggle it.

Check this out:

https://jsfiddle.net/qw5c8qL8/1/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.