2

I have a registration page. There I have a form with 2 required inputs - email and password.

<div class="row row_registration">
    <label for="email">Электронная почта</label>

    <div class="row-w">
        <input id="email" name="email" class="text v" required="required" type="email" value="">
    </div>
</div>
<div class="row row_registration">
    <label for="password">Пароль</label>

    <div class="row-w">
        <input id="password" name="password" class="text eq" minlength="7" required="required" type="password" value="" maxlength="14">
    </div>
</div>

Also I have a submit button (surprise!), which has an attribute "disabled".

var checkRequiredInput = function(){
    if($("#email").val().length > 0 && $("#password").val().length > 0) {
        $(".registration__button button:submit").attr("disabled", false);
    }
};

I bind keyup on inputs. And! I run this function when document is ready.

checkRequiredInput();
$("#email, #password").on("keyup", function(){
    checkRequiredInput();
});

But I have some values on this page that google chrome puts in my inputs and it happenes.. when?

Because my function changes nothing when I run it when document is ready. I understand, that on this moment inputs are empty. I can't use setTimeOut because of different internet connection.

Does any event or something exist to bind the moment when chrome does this.

1 Answers1

1
  1. As practice shows - autocomplete and cash values for inputs are no the same.
    So even if I add attribute automplete my problem stays.
  2. It is possible to combine 2 events and bind keyup and change. It works but shows design changes (disabled button) only after next any action: click, focus, blur, keypress and etc. Much better, but still not good enough.
  3. How browser desides where to put values? By type and user's previous actions on this site. I can't change types of inputs.
  4. Also I know that https does not allow browser to use autocomplete. Only hardcore.

How did I resolve my problem: html5 helps alot (I added many different restictions to inputs) so designer and I desided to delete disabled. The rest will be happened automatically. Thank you, HTML5!