W konsoli pod menu ELEMENT sa tylko tagi html a w CONSOLE nie ma nic.
Nic nie dała zmiana z ID na klase bo i tak tylko ostatnie pole text działa tj. wyswietlaja się nazwy państw
To skrypt:
<html>
<head>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<style>
p, div, input {
font: 16px Calibri;
}
.ui-autocomplete {
cursor:pointer;
height:120px;
overflow-y:scroll;
}
</style>
</head>
<body>
</body>
<?php
for($i=0;$i<=5;$i++)
{
echo "<input type=\"text\" class=klasa$i/><br>";
?>
<script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa<?=$i;?>').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<?php
}
?>
Zrodlo strony
<html>
<head>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<style>
p, div, input {
font: 16px Calibri;
}
.ui-autocomplete {
cursor:pointer;
height:120px;
overflow-y:scroll;
}
</style>
</head>
<body>
</body>
<input type="text" class=\'klasa0\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa0').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<input type="text" class=\'klasa1\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa1').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<input type="text" class=\'klasa2\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa2').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<input type="text" class=\'klasa3\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa3').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<input type="text" class=\'klasa4\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa4').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>
<input type="text" class=\'klasa5\'/><br><script>
$(document).ready(function() {
BindControls();
});
function BindControls() {
var Countries = ['ARGENTINA',
'AUSTRALIA',
'BRAZIL',
'BELARUS',
'BHUTAN',
'CHILE',
'CAMBODIA',
'CANADA',
'DENMARK',
'DOMINICA',
'INDIA'];
$('.klasa5').autocomplete({
source: Countries,
minLength: 0,
scroll: true
}).focus(function() {
$(this).autocomplete("search", "");
});
}
</script>
</html>