validio / jquery-clearsearch Goto Github PK
View Code? Open in Web Editor NEWClearSearch - A search input field plugin for jQuery.
License: Other
ClearSearch - A search input field plugin for jQuery.
License: Other
Hello,
Would be great to add a bower.json package ;)
$this.trigger('changeDate');
In a responsive form the controls will certainly resize. So it'd be great if the clear button moved with the control.
For a quick fix I added a call to update() but had to run it off the window.resize event.
Using a timeout made it run smooth.
...
triggerBtn();
$(window).resize(()=> {
if (this.resizeTO)
clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(()=> {
update();
}, 500);
});
});
I just appened this to the end of the jq object.
Right now, the button is disappearing when the clearable input is in focus. If you give the button a higher z-index value, it'll stay visible at all times.
The wrapper div put around the input element can break layouts that depend on the input staying as inline. Suggest adding 'inline-block' to the style declaration on the wrapper div. This seems to work for my particular instance.
diff:
[sdavied@linuxweb js]$ svn diff jquery-clearsearch.js
Index: jquery-clearsearch.js
===================================================================
--- jquery-clearsearch.js (revision 359)
+++ jquery-clearsearch.js (working copy)
@@ -43,7 +43,7 @@
divClass = settings.clearClass + '_div';
if (!$this.parent().hasClass(divClass)) {
- $this.wrap('<div style="position: relative;" class="'
+ $this.wrap('<div style="display: inline-block; position: relative;" class="'
+ divClass + '">' + $this.html() + '</div>');
$this.after('<a style="position: absolute; cursor: pointer;" class="'
+ settings.clearClass + '">' + settings.linkText + '</a>');
Edit: posted the correct diff (old one applied to the anchor rather than div - oversight on my part)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.