2

so I have this page that contains a card, inside it, there is a button named add. when I click on the add button a modal appears which requests you to input the name of the new card after that the modal contains a close and save button after clicking on save a new card should be generated beside the older one.

so the older card is the older one that has to be clicked in order to add new cards beside it.

does anyone know how I can manage to do all this?

i know how to create a card and modal but how to autogenerate a new card is what i dont know.

Jose
  • 21
  • 1
  • 1
    Sounds like you're looking for [`document.createElement()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement) –  May 04 '21 at 06:07

1 Answers1

2

We could use some code examples to see how this works, but this should be simple using jQuery.

You could take a look at this and see if it helps: https://codepen.io/nickunjchopra/pen/zYZOGop

jQuery(document).ready(function() {
  jQuery('.new-card').click(function() {
    jQuery('body').append(card);
  });
});

.new-card is the button used to create new cards; and I've defined var div in the JS as markup for the new card.

nchopra
  • 511
  • 4
  • 9