Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 31, 20196 yr on the event "tokenAdded", could you also send the name of the autocomplete it came from? this way i can filter it in the listener. right now i have several on the page, and i'm checking each one to see if they have "tokens" to see which one it came from, so it would be much more efficient if i could do something like: switch( data.tokenContainer ){ case 'tokenContainer1': //do something break; case 'tokenContainer2': //do something else break; }
February 1, 20196 yr The event is triggered on the autocomplete element itself, so you should be able to determine which element it came from by using e.currentTarget or e.target (depending on how you set up your event handlers) 🙂 An example from one of our controllers: initialize: function () { this.on( 'tokenAdded', '[data-ipsAutocomplete]', this.changeField ); }, changeField: function (e) { var autocomplete = $( e.currentTarget ); }
February 1, 20196 yr Is it possible to autocomplete the search bar? Like google where it predicts what you are typing?
February 1, 20196 yr Author 2 hours ago, Rikki said: The event is triggered on the autocomplete element itself, so you should be able to determine which element it came from by using e.currentTarget or e.target (depending on how you set up your event handlers) 🙂 An example from one of our controllers: initialize: function () { this.on( 'tokenAdded', '[data-ipsAutocomplete]', this.changeField ); }, changeField: function (e) { var autocomplete = $( e.currentTarget ); } i don't like this feeling...the shame it carries, that i have to admit @Rikki's javascript kung-fu is better than mine 😞 if any one needs me i'll be crying into my drink at some sleazy bar 😞 just kidding, yeah it was definitely my methodology here, i was observing the document for my listener, $(document).on('tokenAdded', function(e, data){}); its why when i originally tried e.currentTarget it was giving me the document lol.
Archived
This topic is now archived and is closed to further replies.