javascript - Toggle Open/Close JS function -


i've never posted here before, , i'm hoping can me. have js function on click toggle display , hiding paragraph. however, need nest them upon 1 another. in other words:

1) text here //click open

 2)this text opens upon click //click open        3)this text opens upon click. 

they way have written now, clicking 1 opens 2 up, clicking 2 closes everything. i'm learning js now, i'm best it, i'm hoping pros here can me. here's function looks http://pastebin.com/zuzp1puj got ideas?

i noticed included jquery in html you're not using anywhere, i'll assume you're new jquery , willing use it.

here's do.

first should read on jquery reference. extremely useful.

the things need give attention these:

  • jquery selectors - use $('.myclass') instead of getelementsbyclassname
  • jquery toggle - or of it's companions (slidetoggle, fadetoggle) asked for.
  • and question - stoppropagation - allows trigger toggle clicked , stop event bubbling through dom. (and not trigger it's parents.)

these 3 combined should work. luck.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -