Avatar of Courtney Whiting
Courtney Whiting
Flag for United States of America asked on

Appending sections in jQuery is adding too many html blocks

I am attempting to have clickable "Add Section" buttons that when clicked will generate and HTML code block. There is a main block and a sub-block. I have it mostly working but the issue comes when I have several main blocks on the screen and I start adding the sub-blocks. I want to only add one block at a time but every time I add a new main block and then a sub block to the previous main block, a sub block for every new main block is added. How can I add just one each time? Follow my JSFiddle link for clarification.

- "main block" is triggered when "Add Question Block" is clicked
- "sub block" is triggered when "Add answer" is clicked

Thanks!
jQueryJavaScript

Avatar of undefined
Last Comment
Courtney Whiting

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robert Schutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Courtney Whiting

ASKER
Perfect solution. Thanks very much.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck