Comments (8)
Try this:
var horse = horsey(el, filter: function (q, suggestion) {
if (q.length < min) {
return false;
}
return horse.defaultFilter(q, suggestion);
});
from horsey.
I guess I'm trying to use it incorrectly
horsey(document.querySelector('#s'), {
suggestions: ['banana', 'apple', 'orange'],
filter: function (q, suggestion) { if (q.length < 3) { return false; } return horse.defaultFilter(q, suggestion);}
}
});
from horsey.
Does that not work for you?
from horsey.
Am I using it correctly? Doesn't seem too
from horsey.
You have an extra }
in line 4, that may be your problem
from horsey.
This works
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/horsey/2.6.1/horsey.min.js"></script>
<script>
var horse = horsey(document.querySelector('#s'), {
suggestions: ['banana', 'apple', 'orange'],
filter: function (q, suggestion) { if (q.length < 2) {
console.log(q);
return false;
}
return horse.defaultFilter(q, suggestion);
}
});
</script>
from horsey.
Cool!
from horsey.
Hi @bevacqua ,
It works, but does not prevents the suggestions
method to be executed. Ajax inside there will be executed but keep hidden. Any Ideia in how to prevent suggestions
? Duplicated the code inside there does not looks good to me. Than you.
from horsey.
Related Issues (20)
- Chinese input not work
- Character highlight broken by case-mismatches HOT 1
- Options for styling HOT 2
- How to use Events of horsey instance? HOT 3
- How to define more that two key:value pairs?
- Matches not refreshing after programmatically adding value and using .show()
- customize source HOT 1
- arrange results in pertinence order
- How can I make highlighting case insensitive? HOT 3
- how to put external source
- library breaks after production build with webpack HOT 4
- Add support for browsers without Symbols
- Disabling highlighter is not possible
- Diacritics
- provide a non-changing category container div at renderCategory()
- sey-list incorrectly positioned when using textarea HOT 1
- Vulnerability report with lodash dependency HOT 1
- Freezing up on large responses (w/ workaround)
- Horsey 3.0.0 not working on android mobile browser
- No searching when pasting?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from horsey.