Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
How can I have a variable of a clone (html elements) appear in another document and not disappear when I refresh [pretty new]

So basically I'm trying to make a very simple add to cart button.

You click, you can continue "browsing" and when you click to go to the cart it will be there in the format I have it set up in.

I don't exactly need help with having it appear with the right text but mostly with cloning it and then appearing in a entirely different document.

I've tried cloneNode, but that simply appears on the same document.

If you know of any functions/way's to help that would help me a lot.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can achieve this in many ways. From storing a value as a parameter in an URL, using localStorage, cookies, make your own state manager or use Redux, React Context API, MobX, etc.

Try with localStorage API.

localStorage.setItem('cartProduct', cartProduct)

then you can read it with

localStorage.getItem('cartProduct)

https://www.taniarascia.com/how-to-use-local-storage-with-javascript/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!