Prevent textbox autofill with previously entered values

后端 未结 8 1138
轮回少年
轮回少年 2020-11-29 11:10

I have an asp page with some Textbox controls on it.

By default, the browser will suggest previously entered values for each box.

I\'d like to prevent that b

8条回答
  •  醉梦人生
    2020-11-29 11:23

    By making AutoCompleteType="Disabled",

          
    

    By setting autocomplete="off",

          
    

    By Setting Form autocomplete="off",

        
    //your content

    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

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

    and here is my textbox in ,

          
    

    By Setting textbox attribute in code,

        protected void Page_Load(object sender, EventArgs e)   
        {  
            if (!Page.IsPostBack)  
            {  
                txt_userid.Attributes.Add("autocomplete", "off");  
            }  
        } 
    

提交回复
热议问题