The JavaScript function does not apply to the form and the confirmation button

23 views Asked by At

The JavaScript function does not apply to the form and the Submit button in HTML The 'js' file is inside another folder I also did the link to the 'js' file correctly

function check_pass() {
  if (document.getElementById('password').value == document.getElementById('passwordconfirm').value) {
      document.getElementById('submit').disabled = false;
  } else {
      document.getElementById('submit').disabled = true;
  }
}
<form name="cForm" id="cForm" method="post" action="php/save.php">
  <fieldset>
      <div class="form-field">
          <input name="username" type="text" id="username" class="full-width" placeholder="نام کاربری" value="">
      </div>
      <div class="form-field">
          <input name="email" type="email" id="email" class="full-width" placeholder="ایمیل" value="">
      </div>
      <div class="form-field">
         <input name="password" type="password" id="password" class="full-width" placeholder="پسوورد" value="" onkeyup="check_pass();">
      </div>
      <div class="form-field">
          <input name="passwordconfirm" type="password" id="passwordconfirm" class="full-width" placeholder="تکرار پسوورد" value="" onkeyup="check_pass();">
      </div>
      <button type="submit" id="submit" class="submit button-primary full-width-on-mobile" disabled>ثبت</button>
  </fieldset>
</form>

0

There are 0 answers