Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
How to pass specific item to another page HTML JavaScript Jquery

I want to pass specific items(paragraphs) to another page with button. I'm currently beginner in web development. Is there any way to do that? also I need to add those "favorite" buttons to every paragraph in my page. There's a lot of them... So is there any way to add those "favorite" buttons(with same ids) to every paragraph and when I click "favorite" button it saves this specific paragraphs that's next to it.

I made "favorite" button next to one of the paragraph. So far I've managed to save favorite buttons toggle state. Now I need to pass this specific "favorited" paragraph\item to another page. Here's my first page:

<!--Name of that file is "page1.html"-->
<p>A<span id="heart"><i class="fa fa-heart-o" aria-hidden="true" ></i></span></p>
<p>B</p>
<p>C</p>
<p>D</p>
<p>E</p>
<p>F</p>
<p>G</p>

<script>
      $(window).on('load',function(){
        if(localStorage.toggled != "with_toggle"){
          $("#heart").html('<i class="fa fa-heart" aria-hidden="true"></i>');
        }else{
          $("#heart").html('<i class="fa fa-heart-o" aria-hidden="true"></i>');
        }
      });
      $('#heart').toggleClass(localStorage.toggled);
      $('#heart').on('click',function(){
        if (localStorage.toggled != "with_toggle") {
          $("#heart").html('<i class="fa fa-heart-o" aria-hidden="true"></i>');
          $('#heart').toggleClass("with_toggle", true);
          localStorage.toggled = "with_toggle";
        } else {
          $("#heart").html('<i class="fa fa-heart" aria-hidden="true"></i>');
          $('#heart').toggleClass("with_toggle", false);
          localStorage.toggled = "";
        }
      });
</script>

And here's my second page:

<!--Name of that file is "page2.html"-->
<body>
    <div>
        <!--SAVED PARAGRAPHS/ITEMS--->
    </div>
</body>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda