<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ГГ</title>
<style>
input {
display: block;
width: 150px;
height: 20px;
}
textarea {
display: block;
outline: none;
border: none;
}
</style>
</head>
<body>
<input type="text">
<textarea cols="30" rows="10"></textarea>
<script>
var projects = [ {
"data": {
"allfilms": {
"rosdestvenskaya istoriya": {},
"sreck": {},
"lednikoviy period": {},
"simsoni": {},
"sauth parck": {},
"rapuncel": {}
}
}
}];
var str = Object.keys(projects[0]['data']['allfilms']).toString()
mas = str.split(','),
textarea = document.querySelector('textarea'),
input = document.querySelector('input');
input.addEventListener('keyup', function(){
textarea.value = '';
var i;
if (input.value !== '')
for (i = 0; i < mas.length; i++){
if (mas[i].indexOf(input.value) !== -1){
textarea.value += mas[i] +"\r\n";
}
}
}, false);
</script>
</body>
</html>