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

259
Views
¿Cómo hacer que Javascript funcione en mi archivo EJS?

He estado tratando de resolver este problema mío desde hace un tiempo. Por favor vea mi código abajo. Quiero comparar mi contraseña y confirmar mi contraseña. Si no es igual, entonces quiero que mi botón esté deshabilitado. Entonces, si coincidía, entonces quiero que el botón esté habilitado. Estoy usando la plantilla ejs, por lo que es difícil para mí poner js dentro. Solo soy un principiante. como esto

código javascript para el botón habilitado y deshabilitado

 <%- include('partials/header') %> <%function check_pass() {%> <% if (document.getElementById('password').value == document.getElementById('conpassword').value) {%> <% document.getElementById('submit').disabled = false;%> <% }else {%> <% document.getElementById('submit').disabled = true;%> <% }%> <% }%> <div class="login-page"> <form autocomplete="off" action="/register" method="POST"> <h1> Sign Up</h1> <label for="lastname"> Last Name </label> <input autocomplete="off" type="text" name="lastname" /> <label for="firstname"> First Name </label> <input autocomplete="off" type="text" name="firstname" /> <label for="email"> Email </label> <input autocomplete="off" type="email" name="username" /> <label for="password"> Password </label> <input name="password" id="password" type="password" onchange='check_pass()'/> <label for="password"> Confirm Password </label> <input name="conpassword" id="conpassword" type="password"onchange='check_pass()' /> <button type="submit" class="submit" id="submit" disabled>>Sign up</button> </form> </div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Elimine la etiqueta <% your script %> de su secuencia de comandos y envuélvala en HTML de secuencia de comandos de etiquetas, es como escribir en formato HTML. Para más información (etiquetas EJS) ver aquí: documentación .

 <script> function check_pass() { if (document.getElementById('password').value == document.getElementById('conpassword').value) { document.getElementById('submit').disabled = false; }else { document.getElementById('submit').disabled = true; } } check_pass(); </script>

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!