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

    4th process
    3rd Process

     Control of Documents
     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
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.

Who is Participating?
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:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.