I have the following json array:
partTags = [{"part":"Part1","dwg":"A"},{"part":"Part2","dwg":"B"}]
Which basically carries the Part Number and a corresponding Drawing Number/Letter
Prior to adding a second parameter ( "Drawing Number ") I just had the part number and I used jQuery autocomplete to search the array. What I want to do now is to Search for the part number in my first input: <input type="text" id="part_number"> and automatically add its corresponding Drawing Number to a second input: <input type="text" id="drawing_number"> upon clicking the part number.
Here is what I had:
$( "#part_number" ).autocomplete({
delay: 100,
source: partTags
});
How can I modify the code above to achieve this? I don't work much with jQuery so I'm quite lost when it comes to some of the API.
Here's what I have so far after fiddling a bit...
$( "#part_number" ).autocomplete({
delay: 45,
source: partTags,
select: function(event, ui)
{
$(this).val(ui.item.part);
$("input#drawing_number").val(ui.item.dwg);
return false;
}
});