JQuery - changing text field value after jquery auto complete select event

A simple change to the text field after the jquery auto complete select event has completed. I want to split the data and display it in other text fields. I am trying to do this. This does not change any values ​​at all. What do I need to change here?

$(function() {
  $("#term").autocomplete({
    source: function (request, response) {
      $.post("/users/search", request, response);
    },
    minLength: 2,
    select: function(event, ui){
        $('#div2').html(ui.item.value); #doesn't populate with new text. 
        document.getElementById('#found').value="test"; #for test
        } #doesn't populate with new text. 
          #I want selected data to go here in the 'found' element id
  });
});

Ruby / html -

<%= text_field_tag :found, nil, :maxlength => 11, :size => 20%>
<input id="found" maxlength="11" name="found" size="20" type="text" />
+3
source share
1 answer

Change this line:

document.getElementById('#found').value="test"; #for test

at

$('#found').val('test');
+4
source

All Articles