How to disable autocomplete on a browser ?

 

In this article, We will see how we can disable any browser autofill, autocomplete on input type by using simple css and javascript code.

Demo : https://www.codingeditors.com/app-file/miss/formautocomplete

<html>
<head>
	<title>Form Autocomplete</title>
</head>
<body>
	<div class="container blog mt-100">
		<form name="login" method="post"  autocomplete="off">
			<h4>Autocomplete Disable</h4>
			<center>
				<div class="row form-group">
					<div class="col-md-5">
						<input name="password" type="text" style="text-security: disc;-webkit-text-security: disc;" autocomplete="new-password" class="form-control" id="label2" tabindex="13" title="password" onfocus="disableautocompletion(this.id);">
					</div>
				</div>
				<div class="row form-group">
					<div class="col-md-5">
						<input type="submit" name="submit" class="btn btn-primary">
					</div>
				</div>
			</center>
		</form>
	</div>
</body>
<script type="text/javascript">
function disableautocompletion(id1){ 
	 var passwordControl=document.getElementById(id1);
	 passwordControl.setAttribute("autocomplete","off");
}
</script>
</html>