Link to home
Create AccountLog in
Avatar of Courtney Whiting
Courtney WhitingFlag 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

Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Courtney Whiting


Perfect solution. Thanks very much.