add and remove duplicate <div>

NepaBort 1 Reputation point
2022-06-27T04:23:21.907+00:00

I'm trying to build a budget evaluator app that will run in a browser. I've been trying to learn javaScript and/or jQuery and other scripting languages for a long time. I've never been able to make any sense of or understand it at all. I'm completely lost. I'm not a professional developer, never had and don't want a job (I'm retired) as a software engineer or coder. I enjoy doing it. It's a hobby. I find it fun most of the time. I continue to get frustrated when I need javaScript of jQuery because I just can't get it.

I have this so far. How do I get the minus buttons that get duplicated with the div's to remove the row they're next to?
Every way I've tried so far in the last few days I've been researching online to try and figure it out hasn't worked.

https://codepen.io/Sickxiczix/pen/RwMbZEJ

Developer technologies ASP.NET ASP.NET Core
Developer technologies ASP.NET Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-06-28T07:31:23.18+00:00

    Hi @NepaBort ,

    Try to modify your code as below: 1. Set the unique Id attribute. 2. Add click function for each "+" button 3. Add the remove button click event:

    215628-image.png

    Then the JS script is like below:

    215608-image.png

    view the source code: 215652-sourcecode.txt

    The result:

    215653-1.gif


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.