[英]How to declare this function in jQuery? $(document).ready is not working
我正在使用FCBKcomplete。 我不知道為什么我的UI不接受$(document).ready
下觸發的任何功能的原因。
我必須像自動完成一樣觸發以下Facebook功能,就像http://www.emposha.com/demo/fcbkcomplete_2/
$(document).ready(function() {
$("#select3").fcbkcomplete({
json_url: "data.txt",
addontab: true,
maxitems: 10,
input_min_size: 0,
height: 10,
cache: true,
newel: true,
select_all_text: "select"
});
});
但這不起作用。 其他事件(例如click
, blur
在我的UI中都正常運行。 是否可以使用替代功能代替document.ready
?
JavaScript庫中的其他一些內容可能已使用$(美元符號)作為選擇器。 因此,如果您獲得$(document).ready is not a function
錯誤或類似錯誤(例如您的$("#select3").fcbkcomplete is not a function
),則必須構建“ 身體防護 ”功能喜歡:
( function($) {
// we can now rely on $ within the safety of our “bodyguard” function
$(document).ready( function() {
alert("Yay I can use '$'!!");
} );
} ) ( jQuery );
select_all_text: "select",
fcbkcomplete()
函數中最后一個選項( select_all_text
)后不應有逗號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.