我有一個問題不能自行解決。我正在調試這幾天,但沒有找到成功,發現問題在哪裏。jQuery選擇:未捕獲NotFoundError:無法執行'節點'上的'appendChild':
我有一個chosen.js + jscrollpane.js。當一個選擇被打開時,搜索輸入字段必須被集中以寫入一些搜索字符串。我第一次打開所選內容會拋出一個錯誤,我無法在其中搜索任何內容。但如果我關閉選擇並重新打開它,一切正常。
我做一個搗鼓你: http://jsfiddle.net/y2h3ohr3/2/
所以錯誤,當我打開第一次選擇,我可以在Chrome中看到的控制檯這個錯誤(在Firefox中,存在錯誤,但控制檯不拋出錯誤):
Uncaught NotFoundError: Failed to execute 'appendChild' on 'Node': The node to be removed is no longer a child of this node. Perhaps it was moved in a 'blur' event handler?
跟蹤該控制檯拋出:
jQuery.extend.buildFragment @ jquery-1.9.1.js:6541
jQuery.fn.extend.domManip @ jquery-1.9.1.js:6129
jQuery.fn.extend.append @ jquery-1.9.1.js:5949
initialise @ jquery.jscrollpane.min.js:115
JScrollPane @ jquery.jscrollpane.min.js:1388
(anonymous function) @ jquery.jscrollpane.min.js:1407
jQuery.extend.each @ jquery-1.9.1.js:648
jQuery.fn.jQuery.each @ jquery-1.9.1.js:270
$.fn.jScrollPane @ jquery.jscrollpane.min.js:1399
(anonymous function) @ chosen.jquery.js:774
jQuery.event.dispatch @ jquery-1.9.1.js:3074
elemData.handle @ jquery-1.9.1.js:2750
jQuery.event.special.focus.trigger @ jquery-1.9.1.js:3256
jQuery.event.trigger @ jquery-1.9.1.js:2952
(anonymous function) @ jquery-1.9.1.js:3677
jQuery.extend.each @ jquery-1.9.1.js:648
jQuery.fn.jQuery.each @ jquery-1.9.1.js:270
jQuery.fn.extend.trigger @ jquery-1.9.1.js:3676
jQuery.fn.(anonymous function) @ jquery-1.9.1.js:7403
$.fn.extend.focus @ jquery-ui.js:230
Chosen.results_show @ chosen.jquery.js:968
Chosen.container_mousedown @ chosen.jquery.js:839
(anonymous function) @ chosen.jquery.js:654
jQuery.event.dispatch @ jquery-1.9.1.js:3074
elemData.handle @ jquery-1.9.1.js:2750
我做一個小提琴,這是不一樣的,我p中的設計roject,但錯誤再現完美(請注意第一次打開時選擇的chrome控制檯)。
你可以在這裏查看小提琴:
http://jsfiddle.net/y2h3ohr3/2/
誰能幫助我?我被困住了,因爲我沒有在任何地方發現錯誤,所以我無法做出更多。錯誤是由jquery拋出,而不是選擇,所以我沒有定製appendChild
。
我可以將更多的信息,只是告訴我,和我分享你需要考慮這個問題。謝謝 –
對於我來說Firefox並不管用。你能說你使用jscrollpane.js嗎?這是不夠的choose.js?如果你從[https://harvesthq.github.io/chosen/](https://harvesthq.github.io/chosen/)上的演示中解釋你的方法不同,我將盡量在晚上實現它。 – vitalii
這是客戶端的一個奇怪的規格。必須使用jscrollpane。是的,這是粗俗的,狗屎的,你所想的所有形容詞都在思考着我。但我無法刪除它。如果你看到小提琴,在選擇的代碼被修改爲使用jscrollpane,所以它不是原來的選擇相同。這是更好的調試一步一步,但我做到了,我不知道問題在哪裏。如果您需要特定信息,請告訴我。謝謝!! –