<p>I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and password. This is a problem on the form to change a password. How can i prevent Firefox from automatically filling out these fields? I already tried giving them different names and ids.</p>

<p>Edit: <a href="https://stackoverflow.com/questions/32369/disable-browser-save-password-functionality">Someone has already asked this</a>. Thanks Joel Coohorn.</p>

[{'answer_id': 50319, 'author': 'Rob Rolnick', 'author_id': 4798, 'author_profile': 'https://Stackoverflow.com/users/4798', 'pm_score': 2, 'selected': False, 'text': '<p>Have you tried adding the autocomplete="off" attribute in the input tag? Not sure if it\'ll work, but it is worth a try.</p>\n'}, {'answer_id': 50320, 'author': 'Ryan Lanciaux', 'author_id': 1385358, 'author_profile': 'https://Stackoverflow.com/users/1385358', 'pm_score': 6, 'selected': True, 'text': '<p>From Mozilla\'s documentation </p>\n\n<pre><code>&lt;form name="form1" id="form1" method="post" autocomplete="off"\n  action="http://www.example.com/form.cgi"&gt;\n[...]\n&lt;/form&gt;\n</code></pre>\n\n<p><a href="http://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion" rel="noreferrer">http://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion</a></p>\n'}, {'answer_id': 50323, 'author': 'George Mauer', 'author_id': 5056, 'author_profile': 'https://Stackoverflow.com/users/5056', 'pm_score': 0, 'selected': False, 'text': "<p>are all your input boxes set to type=password? That would do it.  One of the things you can do, and I'm not at all sure that this is the best answer is to leave input box as an input type and just use javascript and onkeydown event to place stars in the input box instead of having the browser render it.  Firefox won't pre-fill that.</p>\n\n<p>As an aside, I have had to work on single-page web-apps and I absolutely hate it.  Why would you want to take away the user's ability to bookmark pages?  To use the back button?</p>\n"}, {'answer_id': 30897967, 'author': 'Jay Nielsen', 'author_id': 2561673, 'author_profile': 'https://Stackoverflow.com/users/2561673', 'pm_score': 3, 'selected': False, 'text': '<p>The <code>autocomplete="off"</code> method doesn\'t work for me. I realized firefox was injecting the saved password in the first password field it encountered, so the solution that worked for me was to create a dummy password field before the password update field and hide it. Like so:</p>\n\n<pre><code>&lt;input type="password" style="display: none;" /&gt;\n&lt;input type="password" name="password_update" /&gt;\n</code></pre>\n'}, {'answer_id': 54696260, 'author': 'Jakub Fojtik', 'author_id': 1333247, 'author_profile': 'https://Stackoverflow.com/users/1333247', 'pm_score': 0, 'selected': False, 'text': '<p>Adding to this answer <a href="https://stackoverflow.com/a/30897967/1333247">https://stackoverflow.com/a/30897967/1333247</a></p>\n\n<p>This is in case you also have a User field in front of the password fields and want to disable autocompletion for it too (e.g. router web config, setting proxy User and Password).</p>\n\n<p>Just create a dummy user field in front of the dummy password field to hide user name autocompletion:</p>\n\n<pre><code>&lt;input type="text" style="display: none;" /&gt;\n&lt;input type="password" style="display: none;" /&gt;\n&lt;input type="password" name="password_update" /&gt;\n</code></pre>\n\n<p>Per the <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields" rel="nofollow noreferrer">docs</a> this is about the Login autocompletion. To disable the normal one (e.g. search terms completion), just use the</p>\n\n<pre><code>autocomplete="off"\n</code></pre>\n\n<p>attribute on the form or inputs. To disable both you need both, since the attribute won\'t disable Login autocompletion.</p>\n'}]
['https://Stackoverflow.com/questions/50316', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3757/']