$.ajax - autocomplete - .live
Hi
I have have written a web service that is called by the following jQuery code. The results of this call are applied to a text box that is on the first row of my inventory table.
- $.ajax({
- type: "POST",
- url: "GetInventoryItems.asmx/GetInventoryItemsOnDivisionID",
- dataType: "json",
- data: "{}",
- contentType: "application/json; charset=utf-8",
- success: function(data) {
- $("input[name='tbTitle_1']").autocomplete({
- minLength: 0,
- source: data.d,
- focus: function(event, ui) {
- $("tbTitle_1']").val(ui.item.value);
- $('#tbSalesPrice_1').val(ui.item.Sale_Price);
- return false;
- },
- select: function(event, ui) {
- $('#tbTitle_1').val(ui.item.value);
- $('#tbSalesPrice_1').val(ui.item.Sale_Price);
- return false;
- }
- });
- },
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- alert(textStatus);
- }
- });
This code works perfectly.
However, my form has a function that adds new rows dynamically.
I need to apply .live to this somehow. I want this so that every tbTitle_? gets this autocomplete. I just don't know how to do it. Getting even this code above working was a stretch to my humble (but growing) jquery skills.
How do I apply .live to this code? Or, how would a recode this so that .live could be applied?