jquery - How do you use typeahead on live elements? -
.
Normally you have it I type it for "code" typeahead element then i pageload on this After using the function and adding a new element. This is running on pageload: Every time I add a new element, call that function: $ (element) .typeahead ({...}) , but how do you use it on "live" elements?
$ (parent) .on ('typeahead', element, function () {? ??});
function addTypeaheadToInput (input) {$ (input) .typeahead (...); }
var inputs = form.querySelectorAll ('[name * = "[search]"]'); (Var i = 0; i & lt; inputs.length; ++ i) {addTypeaheadToInput (input [i]); }
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
Post a Comment