如何选择文字?

I'm trying to do like autocomplete, when person write something in text box on key up the data show up in div below the text box,there is ajax involved but I didn't use it here to make it simple, and no I don't want to use jquery autocmplete, what I want after the text show up in my d1"div" to select a text and put in the textbox

function call(DIV) 
{
  var str=["app","action","false","true"];          
  $("#d1").html(str);  
}

<html>
  <body>
    <div id="dd">       
      <div><img src="logo.png" style="width:280px;height:160px;" /></div>
      <div><input type="text" id="search_box" size="40" name="se" onkey="up"/></div>
      <div id="d1"></div>
    </div>  
  </body>
</html>

To put d1 html in textbox, you can use:

 $('#search_box').val($('#d1').html());

This is what you need:

var str=["app","action","false","true"];

$.each(str,function(index,item){

$("#d1").append('<li class="items">'+item+'</li>')

})

$(document).on('click','li.items',function(){

$('#search_box').val($(this).text());

})

Fiddle DEMO

Here. is jsfiddle link of solution.

This is main logic to to put text in to textbox on click.

$("a").click(function(){
       $("#textboxId").val($(this).html())
})