this code in book jQuery in action page 131
i don’t understand
.trigger(‘adjustName’);
what is adjustName
and Simple explanation for trigger()
thanks 🙂
$('#addFilterButton').click( function() {
var filterItem = $('<div>')
.addClass('filterItem')
.appendTo('#filterPane')
.data('suffix','.' + (filterCount++));
$('div.template.filterChooser')
.children().clone().appendTo(filterItem)
.trigger('adjustName');
});
It is a string, the name of a custom event you defined.
E.g. it would trigger the event handler bound by:
For more information I suggest to have a look at the documentation:
Without knowing the context of the code, I would say that calling
.trigger()here has no effect, as it is called on thecloneed elements and the event handlers are only cloned iftrueis passed toclone.