Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I reckon the problem is that you don't add the autocompletion to the new element. You don't actually need livequery. Therefore, changing your second block of code like so:</p> <pre><code>$('#AddProduct').click(function() { var adding = $('&lt;div class="column width50"&gt;&lt;input type="text" id="PRODUCTNAME" name="PRODUCTNAME" value="" class="width98" /&gt;&lt;input type="hidden" id="PRODUCTID" name="PRODUCTID" /&gt;&lt;input type="hidden" id="UNITPRICE" name="UNITPRICE" /&gt;&lt;small&gt;Search Products&lt;/small&gt;&lt;/div&gt;&lt;div class="column width20"&gt;&lt;input type="text" id="UNITPRICE" name="UNITPRICE" value="" class="width98" /&gt;&lt;small&gt;Quantity&lt;/small&gt;&lt;/div&gt;&lt;div class="column width30"&gt;&lt;span class="prices"&gt;Unit Price:&lt;br /&gt;Total Price:&lt;/span&gt;&lt;/div&gt;'); $('#OrderProducts').append(adding); adding.find("#PRODUCTNAME").autocomplete("orders.cs.asp?Process=ListProducts", { selectFirst: false }).result(function(event, data, formatted) { if (data) { adding.find("#PRICE").val(data[1]); adding.find("#ID").val(data[2]); adding.find("#UNITPRICE").val(data[1]); adding.find("#PRODUCTID").val(data[2]); } }); return false; }); </code></pre> <p>I reckon that should do it, barring one or two small tweaks here and there.</p> <p>Just two comments on how you are handling your form elements by the way - your method results in more than one element possessing the same ID, which is invalid (although it will work) - perhaps alter it to select based on classes instead. Secondly, you used the html function to set the value of the inputs - not even sure that works, so in my proposed solution I replaced the html calls with val.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload