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

207
Views
Al hacer clic en revelar una dirección de correo electrónico

Tengo el siguiente código que me permite revelar una dirección de correo electrónico al hacer clic. El problema es que quiero que Mostrar correo electrónico desaparezca cuando hago clic en él y solo devuelvo la dirección de correo electrónico.

¿Puedes ayudarme?

¡Gracias!

 function SEmail() { var x = document.getElementById('email'); if (x.style.display == 'none') { x.style.display = 'block'; } }
 <p class="email"> <?php _e('E-mail:', 'theme') ?> <span onclick="SEmail()"><a href="#">Show E-mail</a></span> <span id="email" style="display:none"><a href="mailto:<?php echo contact_email(); ?>">Email link</a></span> </p>

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

0

Lo resolvió con lo siguiente, dando la identificación del texto al texto del marcador de posición:

 <script> function SEmail() { var x = document.getElementById('email'); x.style.display = 'block'; var y = document.getElementById('text'); y.style.display = 'none'; } </script>
 <p class="email"> <?php _e('E-mail:', 'theme') ?> <span id="text" onclick="SEmail()"><a href="#">Show E-mail</a></span> <span id="email" style="display:none"><a href="mailto:<?php echo contact_email(); ?>">Email link</a></span> </p>

Gracias por la ayuda @ChrisG y @isherwood

about 4 years ago · Juan Pablo Isaza Report

0

Simplemente agregue otra función para ocultarla al hacer clic

prueba esto

HTML:

 <p class="email"> <?php _e('E-mail:', 'theme') ?> <span onclick="SEmail()"><a href="#">Show E-mail</a></span> <span onclick="HideEmail()" id="email" style="display:none"><a href="mailto:<?php echo contact_email(); ?>">Email link</a></span> </p>

JavaScript

 function SEmail() { var x = document.getElementById('email'); if (x.style.display == 'none') { x.style.display = 'block'; } else { x.style.display = 'none'; } } function HideEmail() { var x = document.getElementById('email'); x.style.display = 'none'; }
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!