我使用jQuery來使從文本到焦點密碼類型的輸入字段開關。這段代碼在Chrome中運行正常,但是當我嘗試在IE 8中使用它時,它只是完全刪除了該字段。 IE 8返回此錯誤:JQuery的IE問題
This command is not supported.
jquery.min.js
Line: 16
Char: 26827
這裏是我使用的HTML代碼:
<div id="reg_passdiv" style="margin-bottom: 5px;">
<input name="reg_pass" class="inputbar italic" type="text" value="Password..." onfocus="if ($(this).attr('class') == 'inputbar italic') { $(this).attr('class', 'inputbar reg'); $(this).detach().attr('type', 'password').appendTo('#reg_passdiv'); this.value = ''; $(this).focus(); }" onblur="if (this.value == '') { $(this).attr('class', 'inputbar italic'); $(this).detach().attr('type', 'text').appendTo('#reg_passdiv'); this.value = 'Password...'; }" spellcheck="false">
</div>
任何人都可以向我解釋,我怎麼能修復這個bug?謝謝!
你試過取出分離()?似乎沒有必要爲你只是改變了屬性 – Bodman
你不得不使用它,因爲你不能改變裝配的輸入的類型。 – Matt
@Matt,是啊在IE安全問題。 – Bodman