+ 1
Disabled property of js is not working with html???..help please..
else{ attempt --; // Decrementing by one. alert("You have left "+attempt+" attempt;"); // Disabling fields after 3 attempts. if( attempt == 0) {document.getElementById("username").disabled = true ; document.getElementById("password").disabled = true; document.getElementById("submit").disabled = true; return false; } }
2 ответов
+ 7
Check your html code, it works with:
<input type="text" id="username">
<input type="password" id="password">
<input type="submit" id="submit">
... maybe you haven't define ids but names ?
Else, test write to property 'disabled' outside conditional branch: this way you can view if problem is within the property assignement or related to the conditional enbranchment ;)
+ 1
got it ...thank you.