jQuery(document).ready(function(a) {
a("body").scrollspy({
target: ".bs-sidebar",
offset: 0
}),
a(window).on("load", function() {
a("body").scrollspy("refresh")
}), setTimeout(function() {
var b = a(".bs-sidebar");
b.affix({
offset: {
top: function() {
var a = b.offset().top,
c = parseInt(b.children(0).css("margin-top"), 10);
return this.top = a - c
},
bottom: function() {
return this.bottom = a(".bs-footer").outerHeight(!0)
}
}
})
}, 100), a(".token-example-field").tokenfield(),
a("#tokenfield-1").tokenfield({
autocomplete: {
source: outp,
delay: 100
},
showAutocompleteOnFocus: !0,
delimiter: [",", " ", "-", "_"]
});
var b = new Bloodhound({
local: loutp,
datumTokenizer: function(a) {
return Bloodhound.tokenizers.whitespace(a.value)
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
b.initialize(), a("#tokenfield-typeahead").tokenfield({
typeahead: [null, {
source: b.ttAdapter()
}]
}), a("#tokenfield-1").on("tokenfield:createtoken",
function(a) {
var b = a.attrs.value.split("|");
a.attrs.value = b[1] || b[0], a.attrs.label = b[1] ? b[0] + " (" + b[1] + ")" : b[0]
}).on("tokenfield:createdtoken",
function(b) {
var c = /\S+@\S+\.\S+/,
d = c.test(b.attrs.value);
d || a(b.relatedTarget).addClass("invalid")
}).on("tokenfield:edittoken",
function(a) {
if (a.attrs.label !== a.attrs.value) {
var b = a.attrs.label.split(" (");
a.attrs.value = b[0] + "|" + a.attrs.value
}
}).on("tokenfield:removedtoken",
function(b) {
if (b.attrs.length > 1) {
var c = a.map(b.attrs, function(a) {
return a.value
});
alert(b.attrs.length + " tokens removed! Token values were: " + c.join(", "))
} else alert("Token removed! Token value was: " + b.attrs.value)
}).tokenfield()
});
jQuery(document).ready(function(a) {
a("body").scrollspy({
target: ".bs-sidebar",
offset: 0
}), a(window).on("load", function() {
a("body").scrollspy("refresh")
}), setTimeout(function() {
var b = a(".bs-sidebar");
b.affix({
offset: {
top: function() {
var a = b.offset().top,
c = parseInt(b.children(0).css("margin-top"), 10);
return this.top = a - c
},
bottom: function() {
return this.bottom = a(".bs-footer").outerHeight(!0)
}
}
})
}, 100),
a(".token-example-field").tokenfield(), a("#tokenfield-3").tokenfield({
autocomplete: {
source: outp,
delay: 100
},
showAutocompleteOnFocus: !0,
delimiter: [",", " ", "-", "_"]
});
var b = new Bloodhound({
local: loutp,
datumTokenizer: function(a) {
return Bloodhound.tokenizers.whitespace(a.value)
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
b.initialize(), a("#tokenfield-typeahead").tokenfield({
typeahead: [null, {
source: b.ttAdapter()
}]
}),
a("#tokenfield-3").on("tokenfield:createtoken", function(a) {
var b = a.attrs.value.split("|");
a.attrs.value = b[1] || b[0], a.attrs.label = b[1] ? b[0] + " (" + b[1] + ")" : b[0]
})
.on("tokenfield:createdtoken", function(b) {
var c = /\S+@\S+\.\S+/,
d = c.test(b.attrs.value);
d || a(b.relatedTarget).addClass("invalid")
}).
on("tokenfield:edittoken", function(a) {
if (a.attrs.label !== a.attrs.value) {
var b = a.attrs.label.split(" (");
a.attrs.value = b[0] + "|" + a.attrs.value
}
}).
on("tokenfield:removedtoken", function(b) {
if (b.attrs.length > 1) {
var c = a.map(b.attrs, function(a) {
return a.value
});
alert(b.attrs.length + " tokens removed! Token values were: " + c.join(", "))
} else alert("Token removed! Token value was: " + b.attrs.value)
}).tokenfield()
});
jQuery(document).ready(function(a) {
a("body").scrollspy({
target: ".bs-sidebar",
offset: 0
}), a(window).on("load", function() {
a("body").scrollspy("refresh")
}), setTimeout(function() {
var b = a(".bs-sidebar");
b.affix({
offset: {
top: function() {
var a = b.offset().top,
c = parseInt(b.children(0).css("margin-top"), 10);
return this.top = a - c
},
bottom: function() {
return this.bottom = a(".bs-footer").outerHeight(!0)
}
}
})
}, 100), a(".token-example-field").tokenfield(), a("#tokenfield-4").tokenfield({
autocomplete: {
source: outp,
delay: 100
},
showAutocompleteOnFocus: !0,
delimiter: [",", " ", "-", "_"]
});
var b = new Bloodhound({
local: loutp,
datumTokenizer: function(a) {
return Bloodhound.tokenizers.whitespace(a.value)
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
b.initialize(), a("#tokenfield-typeahead").tokenfield({
typeahead: [null, {
source: b.ttAdapter()
}]
}), a("#tokenfield-4").on("tokenfield:createtoken", function(a) {
var b = a.attrs.value.split("|");
a.attrs.value = b[1] || b[0], a.attrs.label = b[1] ? b[0] + " (" + b[1] + ")" : b[0]
}).on("tokenfield:createdtoken", function(b) {
var c = /\S+@\S+\.\S+/,
d = c.test(b.attrs.value);
d || a(b.relatedTarget).addClass("invalid")
}).on("tokenfield:edittoken", function(a) {
if (a.attrs.label !== a.attrs.value) {
var b = a.attrs.label.split(" (");
a.attrs.value = b[0] + "|" + a.attrs.value
}
}).on("tokenfield:removedtoken", function(b) {
if (b.attrs.length > 1) {
var c = a.map(b.attrs, function(a) {
return a.value
});
alert(b.attrs.length + " tokens removed! Token values were: " + c.join(", "))
} else alert("Token removed! Token value was: " + b.attrs.value)
}).tokenfield()
});
答案 0 :(得分:0)
根据文档,我可以向您保证,多个document.ready函数正在运行......
$(document).ready(function() {
alert("test1!");
});
$(document).ready(function() {
alert("test2!");
});
看到这个小提琴:
无论如何,如果你真的在问“如何结合”,o.O - 只需将它们全部放在一个功能体中......
样品:
$(document).ready(function() {
alert("test1!");
alert("test2!");
});
正如您在第一个示例中看到的那样,document.ready()都被调用,因此您的脚本中必须有一个可能的运行时错误导致它中断,这可能是一个非现有的变量或对象,因为它在“if”,null对象是一个无效的数组索引..如果没有一个像样的例子,你的代码太长而且复杂,无法读取。
如果您需要任何帮助,请提供您工作所需的页面的HTML输出,并为其创建一个示例小提琴,并简要解释它应该做什么,然后我们可以检查为什么它没有做你期望它做的事。
但是您的主题主题得到了回答并被证明是错误的。
答案 1 :(得分:0)
$result = $conn->query("SELECT cname from country");
$outp = "[";
$loutp="[";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$outp =$outp.''.$rs["cname"].'';
if ($loutp != "[") {$loutp .= ",";}
$loutp=$loutp.'{value:'.'"'.$rs["cname"].'"}';
}
$outp .="]";
$loutp.="]";
答案 2 :(得分:0)
感谢所有我已经解决了我的问题jquery代码没有执行完整,因为loutp是字符串但是需要对象代替字符串所以我使用eval(loutp)转换它;现在jquery完全执行并且现在正常工作