原文:解決這個報錯:Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

因為在input標簽用了type number , 導致報錯 說明:從chrome 版本開始, chrome瀏覽器只支持獲取type為text, search, URL, tel and password的input元素的selectionStart, selectionEnd 和 setSelectionRange 屬性, 在其余類型中嘗試獲取這些屬性chrome會提示錯誤。 解決方法: 在n ...

2021-03-10 14:50 0 387 推薦指數:

查看詳情

nuxt生產環境報錯:Failed to execute 'appendChild' on 'Node': This node type does not support this method...

初次用nuxt,發現它的坑還真不少,一個坑能坑你很久,這里我給大家做一個匯總 今天在打包測試環境的時候發現啟動項目,瀏覽器里報標題所示的錯誤,乍一看,不知所措,就開始找原因,你會發現,在本地開發的時候同樣也有報錯 這里還給你列出了出問題的父級和子級元素,看起來還挺人性化,然后找到 ...

Mon Mar 21 08:46:00 CST 2022 0 1838
解決TS報錯Property 'style' does not exist on type 'Element'

在使用queryselector獲取一個dom元素,編譯時卻報錯說property 'style' does not exist on type 'element'。 原因:這是typescript的類型檢查導致的,需要在querySelector方法前面加個類型斷言。 擴展 ...

Fri Dec 21 22:58:00 CST 2018 0 10561
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

今天復習了一下關於getComputedStyle的用法,遇到了小小的挫折。報錯前的代碼: 當然,這只是隨便舉的例子,然而卻遇到了標題上面的報錯,糾結了一會后,終於解決了。原來是獲取dom元素時,應該通過標簽中的id屬性去獲取,這樣僅需要改為 var box ...

Tue Jul 16 07:08:00 CST 2019 0 3957
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM