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

193
Views
cómo verificar si el elemento tiene este valor o no

Aquí está mi código, mezclé el código líquido y js, obtuve el identificador del producto, pero esto, si la condición no funciona, tengo una etiqueta con el valor del atributo, aún muestra que no se encontró, ¿alguien puede ayudarme con este problema?

 <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 answers
Answer question

0

Pruebe con esto, use el acento grave para product.handle y también para contenido html en jquery. :)

& Eliminar el espacio en blanco después de 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 Report

0

Pruebe esto Puede obtener directamente el valor por atributo usando jquery.

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

Gracias.

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!