剛剛在整合不同版本下寫的 jQuery code統一到新版本,在IE下碰到莫名的錯誤,追了一下原來踩到雷了。
引用jQuery .attr()的說明:
Note: Internet Explorer does not allow you to change the
type
attribute of an<input>
or<button>
element.
所以
var b = $('<input />');
b.attr('type', 'button');
這樣的寫法在目前最新jQuery的版本(1.6.1)下,無法在 IE 底下運作。必須改為:
var b = $('<input type="button" />');
文章標籤
全站熱搜
留言列表