Jqueryからこのコードをコピーしました。私のシステムでこのコードを実行しようとすると、何も実行されません。ヘッダータグのスクリプトで何かを変更する必要はありますか?以下は自動完成コードを実行できません
私はコピーしたコードです:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>autocomplete demo</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
</head>
<body>
<label for="autocomplete">Select a programming language: </label>
<input id="autocomplete">
<script>
var tags = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ];
$("#autocomplete").autocomplete({
source: function(request, response) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term), "i");
response($.grep(tags, function(item){
return matcher.test(item);
}));
}
});
</script>
</body>
</html>
私はjQueryのに新しい、私はヘッダー内のスクリプトファイルを継承を知らないです、あなたもそれを行う方法を説明できますか?
ありがとうございます。
のような完全なURIを指定することで、外部リソースをロードしようとすることができますか?問題はjQueryとUIファイルのリソースプロトコルだと私は思う。ファイルシステムから直接ロードされたhtmlファイルから実行している場合(ロケーションバーのページURLは 'file://'で始まります)、動作しません。 –
3つの '//code.jquery .com'を 'https:// code.jquery.com'に変更しました –
あなたは' https:// code.jquery.com'を意味しました –