更改input的type屬性
方法一:
<input name="loginPassword" type="text" class="input" id="loginPassword" autocomplete="off" οnfοcus="this.type='password'"/>
但是type方法在IE下不認
方法二:使用jQuery
$("#loginPassword").attr('type','password');
<td><div id="pwdid"><input name="loginPassword" type="text" class="input" id="loginPassword" autocomplete="off" οnfοcus="changeP()"/></div></td>
$('pwdid').replace('<input name="loginPassword" type="password" class="input" id="loginPassword" autocomplete="off"/>');
新增瀏覽器識別
function changeP(){
var browserName=navigator.appName;
if (browserName=="Netscape"){
document.getElementById('loginPassword').type ="password";
} else if(browserName=="Microsoft Internet Explorer") {
$('pwdid').replace('<input name="loginPassword" type="password" class="input" id="loginPassword" autocomplete="off"/>');
}
}
相關文章
- jQuery type屬性值篩選input元素jQuery
- 動態修改input元素type屬性值
- css匹配type屬性值為text的input元素CSS
- js根據input標籤的type屬性篩選元素JS
- css設定具有指定type屬性值的input文字框的樣式CSS
- Blob type 屬性
- File type 屬性
- <th>標籤的<input type="reset"/>重置按鈕簡單介紹屬性
- js通過type屬性值篩選input元素程式碼例項JS
- <input> readonly屬性
- input標籤單行文字域type="text"的可以新增屬性以及其描述
- DataTransferItem.type 屬性
- CSSStyleSheet.type 屬性CSS
- HTML 省略type屬性HTML
- input標籤autocomplete 屬性
- jQuery中判斷input的disabled屬性jQuery
- List-style-type屬性失效
- Input的size與maxlength屬性的區別
- form(表單)中input屬性type的種類(number,email,url,tel,datetime),正規表示式ORMAI
- Hive學習之更改表的屬性Hive
- 【ASM】ASMCMD chtmpl 更改ASM 模版的屬性ASM
- input placeholder屬性用法介紹
- react input[type='number']React
- input type="file"使用
- win10怎麼更改網路屬性_要如何更改網路屬性windows10Win10Windows
- win10怎樣更改連線屬性_win10怎麼更改網路屬性Win10
- input屬性disabled和readonly的區別(轉)
- textarea 多行文字域 type 屬性值
- list-style-type屬性用法介紹
- 如何清除<input type="file">的值
- type=“file”的input標籤美化
- JQuery獲取input type=jQuery
- <input>文字框的readonly和disabled屬性區別
- PostgreSQL/Lightdb 更改列屬性語法SQL
- logstash-input-file 配置屬性詳解
- textarea多行文字域的type屬性值是textarea
- 問題No property 屬性名 found for type 類名
- <button>和<input type=“button“> 的區別