question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No documentation or examples for listening to events

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Reactions:15
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
LeaVeroucommented, Jan 23, 2017

Awesomplete.$.bind is just a small utility for attaching multiple event listeners. For a case like this, normal JS addEventListener should work just fine and is more readable:

document.getElementById('YOUR-INPUT-ID').addEventListener("awesomplete-select", function(event) {
    console.log( event.text.label, event.text.value );
});
3reactions
eliasgonzalezugaldecommented, Apr 28, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found