Reputation: 525
I am dead trying various combinations to stop browser (not only Chrome, but also Mozilla) from irritating autocomplete, and still no success. What I have for now:
<form id = 'user_form' autocomplete="off" role="form">
<input name="hidden" type="text" style="display:none;">
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3">
<input autocomplete="off" class="form-control input-sm" id="id_username"
maxlength="30" name="username"
placeholder="Имя пользователя" required="" type="text" />
</div>
</div>
</form>
I did not post any JSFiddle, because it's no help for this question. I've also tried false
in place of off
. But no success again.
UPDATE
After following 's suggestion, I have modified the code to include hidden password input, and in Firefox it's all right now. But in Chrome autocomplete still works for real password-type inputs.
My code as is:
<form id = 'user_form' autocomplete="off" role="form">
<input style="display:none"/>
<input type="password" style="display:none"/>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-2">
<div class = 'zeon_non_field_error_wrap'>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3">
<input autocomplete="off" class="form-control input-sm" id="id_username" maxlength="30" name="username" placeholder="Имя пользователя" required="" type="text" />
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3">
<input autocomplete="off" class="form-control input-sm" id="id_password" maxlength="128" name="password" placeholder="Пароль" required="" type="password" />
</div>
</div>
</form>
Upvotes: 0
Views: 308
Reputation: 982
I found that Chrome only autocompletes the first <input type="password">
and the previous <input>
. So the workaround would be to add to the top of the <form>
:
<input style="display:none">
<input type="password" style="display:none">
Depending on chrome versions. Works for me on Chrome 47
Upvotes: 1