Answered by:
clear Cache

Question
-
User-797751191 posted
Hi
I have textboxes . It shows previous values when data is entered. i want that previous values entered should not display.
Thanks
Tuesday, June 25, 2019 10:59 AM
Answers
-
User-1038772411 posted
Hello jsshivalik,
my textbox
<asp:TextBox runat="server" ID="txt_userid" ></asp:TextBox>
By making AutoCompleteType="Disabled",
<asp:TextBox runat="server" ID="txt_userid" AutoCompleteType="Disabled"></asp:TextBox>
By setting autocomplete="off",
<asp:TextBox runat="server" ID="txt_userid" autocomplete="off"></asp:TextBox>
By Setting Form autocomplete="off",
<form id="form1" runat="server" autocomplete="off"> //your content </form>
By using code in .cs page,
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txt_userid.Attributes.Add("autocomplete", "off"); } }
By Using Jquery
<head runat = "server" > < title > < /title> < script src = "Scripts/jquery-1.6.4.min.js" > < /script> < script type = "text/javascript" > $(document).ready(function() { $('#txt_userid').attr('autocomplete', 'off'); }); //document.getElementById("txt_userid").autocomplete = "off" < /script>
By Setting textbox attribute in code,
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txt_userid.Attributes.Add("autocomplete", "off"); } }
Thank you
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 25, 2019 11:07 AM -
User753101303 posted
Hi,
It seems the autocompletion mechanism found in most if not all browsers. Try to set autocomplete to off on your form : https://www.w3schools.com/tags/att_input_autocomplete.asp
Make sure also it's best to disable that rather than to let each user control which behavior they want.information.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 25, 2019 11:07 AM
All replies
-
User-1038772411 posted
Hello jsshivalik,
my textbox
<asp:TextBox runat="server" ID="txt_userid" ></asp:TextBox>
By making AutoCompleteType="Disabled",
<asp:TextBox runat="server" ID="txt_userid" AutoCompleteType="Disabled"></asp:TextBox>
By setting autocomplete="off",
<asp:TextBox runat="server" ID="txt_userid" autocomplete="off"></asp:TextBox>
By Setting Form autocomplete="off",
<form id="form1" runat="server" autocomplete="off"> //your content </form>
By using code in .cs page,
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txt_userid.Attributes.Add("autocomplete", "off"); } }
By Using Jquery
<head runat = "server" > < title > < /title> < script src = "Scripts/jquery-1.6.4.min.js" > < /script> < script type = "text/javascript" > $(document).ready(function() { $('#txt_userid').attr('autocomplete', 'off'); }); //document.getElementById("txt_userid").autocomplete = "off" < /script>
By Setting textbox attribute in code,
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txt_userid.Attributes.Add("autocomplete", "off"); } }
Thank you
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 25, 2019 11:07 AM -
User753101303 posted
Hi,
It seems the autocompletion mechanism found in most if not all browsers. Try to set autocomplete to off on your form : https://www.w3schools.com/tags/att_input_autocomplete.asp
Make sure also it's best to disable that rather than to let each user control which behavior they want.information.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, June 25, 2019 11:07 AM -
User288213138 posted
Hi jsshivalik,
You can use the val() method in jquery to set the value of the TextBox to null.
The code:
<script> $(document).ready(function () { $('#TextBox1').blur(function () { var Name = $('#TextBox1').val(); console.log(Name); $('#TextBox1').val(""); }) }) </script> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div>
The result:
Best regards,
Sam
Tuesday, June 25, 2019 11:53 AM