javascript - Jquery Auto Complete Does Not Append -
jquery newbie here. jquery append not seem working. appreciated.
i using jquery version 1.8.3 , ui 1.9.2.
below code.
$('.tinputer').autocomplete({ source: "http://localhost/myapp/items/search_item", minlength: 1, select: function(event, ui) { var $itemrow = $(this).closest('tr'); $itemrow.find('#item_description').val(ui.item.description); $itemrow.find('#unit_price').val(ui.item.price); $itemrow.find('#qty').focus(); verify_item(ui.item.value); } }).data("autocomplete" )._renderitem = function( ul, item ) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.value + item.description + "</a>" ) .appendto( ul ); };
fiddle - http://jsfiddle.net/yw2y7/1/ try typing in item box on second row. first row works.
the results populated, , drop down, value shown. item.description not appended or seems append section ignored.
your appreciated.
$('.tinputer').autocomplete({ source: projects, minlength: 1, select: function (event, ui) { var $itemrow = $(this).closest('tr'); $itemrow.find('#item_description').val(ui.item.description); $itemrow.find('#unit_price').val(ui.item.price); $itemrow.find('#qty').focus(); verify_item(ui.item.value); } }). each(function(){ //this line added. $(this).data("autocomplete")._renderitem = function (ul, item) { return $("<li></li>") .data("item.autocomplete", item) .append("<a>" + item.value + " - " + item.description + "</a>") .appendto(ul); } } );
Comments
Post a Comment