This event is attached to a set of elements:
var elems = $(this).filter(function(){
...
});
How can I trigger a change event on these elements within a change event handler, but ignore the current element?
elems.bind('change input', function(){
// do some stuff...
// then trigger change, but not on "this", to avoid the recursion issue
elems.change();
});
Basically I want ot ignore this
from elems
, but only in my "manual" change()-call above...
var elems = $(this).filter(function(){
ReplyDelete...
});
elems.bind('change input', function(){
// then trigger change, but not on "this", to avoid the recursion issue
elems.not(this).change();
});
Though I must say, this scenario looks like a poor design issue.
When element get changed it sets a change event callback to some elements including him self... sound awkward and that recursion is just a symptom to other bigger problem...
It probably can be done in a a lot cleaner way then this.
Try this:
ReplyDeleteelems.not(this).change();
You can just filter out the current element:
ReplyDeleteelems.not(this).trigger('change'); // or just .change()