3
關聯爲快速概述,我正在嘗試將fancybox應用於通過ajax提取的元素。如何查看哪些對象與DOM元素
我目前使用此代碼來應用jQuery UI的日曆小部件,以將其應用於新內容。
$('.date').live('focusin', function() {
var $this = $(this);
if(!$this.is(':data(datepicker)')) {
//this will attach a datepicker control & datepicker will immediately fire
$this.datepicker();
}
});
我明白這是幹什麼的,在鼠標懸停它會檢查,看是否日期選擇對象應用於元素,如果不適用,然後觸發它。
我不確定的是雖然看起來jQuery UI的datepicker使用標識符「datepicker」我不確定fancybox會使用什麼。
我很確定我記得有一種方法可以查看哪些對象應用於螢火蟲中的dom元素,但我似乎無法找到它。
有誰知道如何找到標識符?
看這裏:http://www.bennadel.com/blog/1727-Viewing-jQuery-DOM-Event-Bindings-With-FireBug.htm – Tomer
我建議'.on'而不是'.live' for性能考慮 –
@MarkSchultheiss性能應該沒有那麼不同,因爲'.live'只是委託給'.on',但是他應該仍然使用'.on',因爲'.live'已經被棄用了...... – Jack