Hello, this is my first post here, I've found answers here before
I have a form where I can add fields that have autocomplete.
Instead of adding the autocomplete to each field as I create them, is it possible to use event binding to add the autocomplete?
I am a newbie when it comes to events in javascript.
This is what I have done to add a new line, using event binding (works perfectly).
$(function() {
$('input[name=addItem]')
.bind('click', function() {
var line = $('#list > div').size()+1;
divId = 'line-'+line;
var divCloned = $('#line-1').clone();
divCloned.attr('id', divId);
$('#list').append(divCloned);
var inputs = $(divCloned).children('input').get();
for (var i in inputs) {
inputs[i].value='';
inputs[i].id = inputs[i].id.replace(/\d+/, line);
inputs[i].name = inputs[i].name.replace(/\d+/, line);
}
this.blur();
});
});
I'm not even sure if I have presented my question in a proper way.
Thank you.