我遇到了JavaScript工具之間的衝突,我的JavaScript知識還不夠先進,無法解決它。jquery-ui-timepicker&drupal的editablefields模塊
我使用drupal的editablefields模塊,允許用戶在節點視圖中內聯編輯字段,以便在節點/%/編輯中編輯它們。
與此我使用弗朗索瓦Gélinas'的jquery-UI-timepicker組合:http://fgelinas.com/code/timepicker/
我碰上是這個問題,稱爲當最初的timepicker被bineded到DOM元素,例如:
#edit-field-days-start-time-und-0-value
使用這樣的代碼:
$('#edit-field-days-start-time-und-0-value').timepicker();
這個偉大的工程,以及timepicker彈出當用戶點擊的領域,他們可以點擊一個新的小時來更新該字段。但只要該更新發生Drupal的editablefields模塊更新領域,改變字段ID來是這樣的:
#edit-field-days-start-time-und-0-value-1
現在的jQuery-UI-timepicker不再綁定到一個真實存在的元素,因此如果在一個widget的第二個按鈕用戶點擊,要說分鐘,我得到一個錯誤:
uncaught exception: Missing instance data for this timepicker
所以我的問題是,如何強制重新綁定timepicker到一個新的ID?或者,如何阻止drupal editablefields模塊保存更新並更改字段的標識直到編輯完成?