Javascript 例如,我的typeahead有什么问题?
我试图为typeahead.js()编写我自己的示例,但由于某种原因,我无法让它工作 小提琴: 我已经包含了JSON,它应该从源代码中的“local”调用加载Javascript 例如,我的typeahead有什么问题?,javascript,jquery,typeahead.js,Javascript,Jquery,Typeahead.js,我试图为typeahead.js()编写我自己的示例,但由于某种原因,我无法让它工作 小提琴: 我已经包含了JSON,它应该从源代码中的“local”调用加载 <div class="example example-degrees"> <h2 class="example-name">Degrees</h2> <div class="demo"> <input class="typeahead" type="text
<div class="example example-degrees">
<h2 class="example-name">Degrees</h2>
<div class="demo">
<input class="typeahead" type="text" placeholder="degrees">
</div>
我想我可以设置一个快速的例子,但我不能让它工作
TIA检查控制台是否有错误。无法加载添加到小提琴中的脚本:
Refused to execute script from 'https://raw.github.com/twitter/typeahead.js/master/src/typeahead.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
所以把它改成这个:
签出:检查控制台是否有错误。无法加载添加到小提琴中的脚本:
Refused to execute script from 'https://raw.github.com/twitter/typeahead.js/master/src/typeahead.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
所以把它改成这个:
签出:您错过了
.ready
及其回调函数的括号
$(document).ready(function() {
$('.example-countries .typeahead').typeahead({
name: 'countries',
local: ["Bachelor of Science",
"Bachelor of Science in Accounting",
"Bachelor of Science in Business",
"Bachelor of Science in Business\/Accounting",
"Bachelor of Science in Business\/Administration",
"Bachelor of Science in Business\/Communications",
"Bachelor of Science in Business\/e-Business",
"Bachelor of Science in Business\/Finance",
"Bachelor of Science in Business\/Global Business Management",
"Bachelor of Science in Business\/Green and Sustainable",
"Bachelor of Science in Business\/Green and Sustainable Enterprise Management",
"Bachelor of Science in Business\/Hospitality Management",
"Bachelor of Science in Business\/Human Resource Management"]
}); // <-- add missing closing bracket for ready().
$(文档).ready(函数(){
$('.example countries.typeahead').typeahead({
名称:'国家',
本地:[“理学学士”,
“会计学理学学士”,
“商业理学学士”,
“商业\会计理学学士”,
“工商管理理学学士”,
“商业\通信理学学士”,
“商业\电子商务理学学士”,
“商业\金融理学学士”,
“商业\全球商业管理理学学士”,
“商业学学士\/绿色与可持续”,
“商业\/绿色和可持续企业管理理学学士”,
“商务\酒店管理理学学士”,
“商业\人力资源管理理学学士”]
});//您错过了.ready
及其回调函数的闭括号
$(document).ready(function() {
$('.example-countries .typeahead').typeahead({
name: 'countries',
local: ["Bachelor of Science",
"Bachelor of Science in Accounting",
"Bachelor of Science in Business",
"Bachelor of Science in Business\/Accounting",
"Bachelor of Science in Business\/Administration",
"Bachelor of Science in Business\/Communications",
"Bachelor of Science in Business\/e-Business",
"Bachelor of Science in Business\/Finance",
"Bachelor of Science in Business\/Global Business Management",
"Bachelor of Science in Business\/Green and Sustainable",
"Bachelor of Science in Business\/Green and Sustainable Enterprise Management",
"Bachelor of Science in Business\/Hospitality Management",
"Bachelor of Science in Business\/Human Resource Management"]
}); // <-- add missing closing bracket for ready().
$(文档).ready(函数(){
$('.example countries.typeahead').typeahead({
名称:'国家',
本地:[“理学学士”,
“会计学理学学士”,
“商业理学学士”,
“商业\会计理学学士”,
“工商管理理学学士”,
“商业\通信理学学士”,
“商业\电子商务理学学士”,
“商业\金融理学学士”,
“商业\全球商业管理理学学士”,
“商业学学士\/绿色与可持续”,
“商业\/绿色和可持续企业管理理学学士”,
“商务\酒店管理理学学士”,
“商业\人力资源管理理学学士”]
});//谢谢!我知道是simpleIt似乎JSFIDLE不再起作用了?:(谢谢!我知道是simpleIt似乎JSFIDLE不再起作用了?:(