Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
var x = document.getElementById("liste1");
// eine Zeile hinzufügen
var option = document.createElement("option");
option.text = 'Hallo Welt';
x.add(option);
<input type="text" name="test1" list="liste1" id='test1' style='width:100px;' onfocus="holeWerte()" value="">
<datalist id="liste1">
<option value='0'>bitte wählen</option>
</datalist>
</input>
.add
kenne ich nicht. mal .appendChild versucht?<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Fenstertitel</title>
<style type="text/css"></style>
</head>
<body>
<input list="list" id="input">
<datalist id="list"></datalist>
<script type="text/javascript">
(function(){
var input = document.getElementById("input");
var list = document.getElementById("list");
var data = ["hallo", "das", "ist", "ein", "Test"];
input.addEventListener("input", function(){
if (this.value.length >= 3){
data.forEach(function(entry){
list.appendChild(new Option(entry, entry));
});
}
else {
list.innerHTML = "";
}
}, false);
}());
</script>
</body>
</html>
Bitte - gern geschehen.danke vielmals