I'm trying to attach VKI (see http://www.greywyvern.com/code/javascript/keyboard) to an element that's being dynamically added to the DOM via Javascript.
Essentially, it's a table with only one row to begin with and there's "Add Row" and "Delete Row". It gets tricky because each row has an input that needs VKI attached to it.
Below is just a snippet of my otherwise larger code to handle adding and deleting row.
$('#add-passenger-row').click(function(){
get_lastID();
$('#passenger-information tbody').append(newRow);
// this doesn't work --- throws "Uncaught TypeError: undefined is not a function"
var myInput = $(newRow).find('#myInput');
VKI_attach(myInput);
// this works
var myInput = document.getElementById('myInput');
VKI_attach(myInput);
});
My question is... how can I make this work? i.e. attach VKI to each input in the row that's added dynamically when a user clicks "Add Row"
I can create JSBin if question is not clear enough.
newRow?