1

How to disable browser's autocomplete effect on all textboxes in asp.net c# application. I have tried following jquery but it doesn't works

$(document).ready(function () {
    $("input[type=text]").attr("autocomplete", "off");
});

Please help me !!!

3 Answers3

1

Add autocomplete="off" attribute in input control.

<input autocomplete="off" id="name" type="text" name="name">
Kaushik Maheta
  • 1,741
  • 1
  • 18
  • 27
1

If you are using c#, you can use this code inside the form. This will disable all the controls autocomplete inside the form.

<form id="Form1" method="post" runat="server" autocomplete="off">

If you want to disable individually, you can use this code.

<asp:TextBox Runat="server" ID="Textbox1" autocomplete="off"></asp:TextBox>

Or you can change the autocomplete at run time:

Textbox1.Attributes.Add("autocomplete", "off");
Samuel Lin
  • 99
  • 8
0

Set the ViewStateMode property of the textbox to Disabled . Should work for you.

Mainak
  • 469
  • 3
  • 9
  • 33