0

I am trying to create an App which has 2 html files, index.html and bookmarks.html. Index.html has some question cards which contain some text and a bookmarks button.

My goal is that when I press the bookmark button in the question card from index.html, that card should be replicated in bookmarks.html.

I was thinking to use the createElement approach, but I have no idea how to do this when the elements that should be created are on a different page...

For more clarity, here is the html code for the question cards in index.html:

<section class="question-card">
    <p>
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam vitae
        labore repudiandae tenetur. Qui maiores animi quibusdam voluptatum
        nobis. Nam aperiam voluptatum dolorem quia minima assumenda velit
        libero saepe repellat. Tempore delectus deleniti libero aliquid rem
        velit illum expedita nostrum quam optio maiores officiis consequatur
        ea, sint enim cum repudiandae inventore ab nemo? Eum dicta illum odio
        harum, commodi similique. Lorem ipsum, dolor sit amet consectetur
        adipisicing elit. Inventore maxime ipsa accusamus, soluta provident
        tenetur aliquid ad nisi voluptate iste quaerat ab ullam voluptatem
        illo eos optio ut dolor nostrum.
    </p>
    <button type="button" class="qc-bookmark-icon">
        <img src="/assets/bookmark-icon.jpeg" alt="bookmark icon"/>
    </button>
</section>

And this is what it looks like, with the bookmark button on the top-right corner.

Question Card

Do you have any idea if this would be the right approach and if yes, how could I implement this?

If not, I am open to any suggestions, how I could make this work...

Thank you.

Apostolos
  • 10,033
  • 5
  • 24
  • 39
  • 1
    If they are two sepearate pages, you would need some way to store that data. That would be localstorage if you do not have a server back end. – epascarello Oct 24 '22 at 19:08
  • Or you can use context API or redux to store the data and pass between pages but yeah these are just ideas to make it work on the client side – Kartoos Oct 24 '22 at 19:24
  • Ok, thanks for the inputs, guys, I will look into localstorage then. Thanks. – Mihai Mazareanu Oct 25 '22 at 06:39

0 Answers0