Answer the question
In order to leave comments, you need to log in
jquery and adding new fields. How to put a handler on dynamically created fields?
I created my field (2 hidden and 1 textfield), assigned autocomplete to them with my widgets (widget factory) - for the first field everything goes well, but when you add a new field (set an unlimited number of fields in the settings) and add text to the new field the handler starts changing the data in all previous fields, tried to apply once() did not help.
Here are the places where selectors are used:
Drupal.behaviors.jqe = {
attach: function (context, settings) {
$('.fields-nazvaniye').once('demo-fields', function () {
$(".fields-nazvaniye", context).makeJqeAutocomplete();
});
}// attach
};
select: function(event, ui) {
// nid скрытому полю.
$('#fields_href').val(ui.item ? ui.item.value.href : 0);
// текст - в поле.
$input.val(ui.item ? ui.item.value.title : this.value);
$('#fields_class').val(ui.item ? ui.item.value.class : '');
return false;
}
});
return this;
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question