Question

The input field I am searching in has to display the label after I select the item and the second field needs to be filled with the value the autocomplete-request gets from the source.

What am I doing wrong?

http://jsfiddle.net/Lj7PC/

select: function( event, ui ) {
    // fill the two fields with the label and value from source              
    this.value = ui.item.label;
    $('#prid').value=ui.item.value;
}
Was it helpful?

Solution

This line:

$('#prid').value=ui.item.value;

Should Be:

$('#prid').val(ui.item.value);

In addition if you want the original input box to display the selected item you would need:

 select: function( event, ui ) {
            event.preventDefault();
            $("#search").val(ui.item.label);
            PK.render(ui.item.value);
        }

Updated JSFiddle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top