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

163
Views
El código funciona perfectamente en codepen pero no en webstorm

El codigo que estoy probando en codepen funciono, el mismo no funciona en webstorm. Nada parece funcionar, no aparece ningún error al hacer clic en el botón,

Ejemplo

 const email = document.querySelector('.user-input'); const submit = document.querySelector('.btn0'); const error = document.querySelector('.mail-error'); const showError = () => { error.style.display = 'block'; }; if (submit) { submit.addEventListener('click', (e) => { e.preventDefault(); if (!email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)) { return showError(); } document.getElementById("main0").style.display = "none"; document.getElementById("main1").style.display = "block"; }); }
 <div id="main0"> <input class="user-input" id="input-id" placeholder="Email" onblur=""> <p class="mail-error" style="display: none;">Please enter valid email</p> <div class="btn0" id="btn0id" onclick="">NEXT</div> </div> <div id="main1" style="display:none;"> <p> You now have access. <p> </div>

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

document.addEventListener("DOMContentLoaded", function(event) { // put your code here });
about 4 years ago · Santiago Gelvez Report

0

Se solucionó agregando "aplazar" al vincular al archivo de script externo, ahora todo funciona bien.

 <script src="script.js" defer></script>
about 4 years ago · Santiago Gelvez 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!