No documentation or examples for listening to events
See original GitHub issueI had to search through random issues to figure out how to listen to events. Here is an example for anyone else:
Awesomplete.$.bind(document.getElementById('YOUR-INPUT-ID'), { "awesomplete-select":function(event)
{
console.log( event.text.label, event.text.value );
}});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Introduction to events - Learn web development | MDN
For example, elements have a property onclick . This is called an event handler property. To listen for the event, you can assign...
Read more >Listening to events | Socket.IO
Listening to events. There are several ways to handle events that are transmitted between the server and the client.
Read more >Listening to property change events - MagicDraw 18.5
These examples show, how to create the property change listeners to listen to the different kind of properties.
Read more >Introduction to Event Listeners (The Java™ Tutorials ...
Any number of event listener objects can listen for all kinds of events from any number of event source objects. For example, a...
Read more >Listening to Events | Maps JavaScript API - Google Developers
This example adds a user-editable rectangle to the map. When the user changes the ... Read the documentation. ... Add an event listener...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesomplete.$.bind
is just a small utility for attaching multiple event listeners. For a case like this, normal JSaddEventListener
should work just fine and is more readable:In regular Javascript
var input = document.getElementById(“inputlist”); new Awesomplete(input, {list: yourlist}); document.getElementById(‘inputlist’).addEventListener(‘awesomplete-selectcomplete’,function(){ alert(this.value); });
In Jquery
var input=$(“#inputlist”)[0]; new Awesomplete(input, {list: yourlist}); $(“#inputlist”).on(‘awesomplete-selectcomplete’,function(){ alert(this.value); });
Source: http://stackoverflow.com/questions/35864545/awesomplete-get-selected-text