jquery - How do you use typeahead on live elements? -


.

Normally you have it $ (element) .typeahead ({...}) , but how do you use it on "live" elements?

  $ (parent) .on ('typeahead', element, function () {? ??});    

I type it for "code" typeahead element then i pageload on this After using the function and adding a new element.

  function addTypeaheadToInput (input) {$ (input) .typeahead (...); }   

This is running on pageload:

  var inputs = form.querySelectorAll ('[name * = "[search]"]'); (Var i = 0; i & lt; inputs.length; ++ i) {addTypeaheadToInput (input [i]); }   

Every time I add a new element, call that function:

  form.querySelector ('# add_new_row'). Onclick = function () {var tr = newrow (); // To create a new table row containing our input elements, addTypeaheadToInput (tr.querySelector ('[name * = "[search]"]')); }    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -