asp.net 輸入框在chrome中沒法關閉自動提示

將asp:TextBox 的屬性AutoCompleteType設爲Disabled,但願在chrome中點擊記住用戶名密碼後輸入框再也不自動提示,但不起做用。chrome

解決方法:this

  <asp:TextBox ID="TeamName" runat="server" TextMode="SingleLine" AutoCompleteType="Disabled" ReadOnly="true"></asp:TextBox>spa

// Disable autocomplete for form fields. This is done by setting the 'autocomplete' attribute (which is deprecated) // as an indicator that we want this field to not be autofilled. We also set these forms to load as readonly (which // will cause browsers to ignore them), and now we mark them writable. $(document).ready(function() { $('form[autocomplete="off"] input, input[autocomplete="off"]').each(function() { var input = this; setTimeout(function() { $(input).removeAttr('readonly'); }, 200); // 100 does not work - too fast. }); });
相關文章
相關標籤/搜索