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

196
Visualizações
how to check if element has this value or not

Here is my code i mixed up liquid code and js i got product handle but this if condition is not working i have tag with attribute value still it shows not found can someone help me with this issue

<a class="hidden_wrap" name="hidden_link" data-color="gold" data-stone="tiger-eye" data-handle="copy-of-joory-earrings-tiger-eye-gold
" style="appearance: auto;"> gold-tiger-eye   </a>

<script>
          var handle = "{{product.handle}}";
         if ($(`a[class='hidden_wrap'][data-handle='${handle}').length > 0) {
                    alert("found");
                  }else
                  {

              alert('not found');
          }
</script>
            

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try With This, Use backtick for product.handle and also for html content in jquery. :)

& Remove White Space after copy-of-joory-earrings-tiger-eye-gold.

<script>
     var handle = `{{product.handle}}`;
     if ($(`a[class='hidden_wrap'][data-handle=${handle}`).length > 0) {
          alert("found");
     }
     else{
          alert('not found');
     }
</script>
about 4 years ago · Juan Pablo Isaza Relatório

0

Try this You can directly get the value by attribute using jquery.

<script>
var handleAttr = $(".hidden_wrap").attr("data-handle");
if(handleAttr){
alert("found");
}else{
alert("not found");
}
</script>

Thanks.

about 4 years ago · Juan Pablo Isaza Relatório
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