當文本輸入具有焦點並按下回車鍵時,document.activeElement.nodeName
應返回INPUT
。這適用於Chrome,Firefox和Safari,但在Internet Explorer/Edge中它返回BUTTON
。Internet Explorer中來自activeElement的錯誤nodeName
我正在使用繁重的JavaScript自定義窗體,Internet Explorer報告了錯誤的nodeName,這導致了一個很大的問題。
See this fiddle for the example.
這是一個已知的問題?有沒有解決方法或修復?
嘗試使用'tagName'。 –