user2179026
user2179026

Reputation:

Disable browser's autocomplete textboxes in asp.net c#

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 !!!

Upvotes: 1

Views: 2962

Answers (3)

Samuel Lin
Samuel Lin

Reputation: 99

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");

Upvotes: 1

Kaushik Maheta
Kaushik Maheta

Reputation: 1861

Add autocomplete="off" attribute in input control.

<input autocomplete="off" id="name" type="text" name="name">

Upvotes: 1

Mainak
Mainak

Reputation: 470

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

Upvotes: 0

Related Questions