jQuery plugin for automagically transforming
input[type="text"] elements into
There are a couple of highly upvoted answers in that thread (with some jQuery plugins written corresponds to them), but I was interested in writing my own because none of them uses jQuery UI icons.
Things have pretty much changed (annually) since then. :bowtie:
Now, the plugin is:
- lightweight (~4 KB),
- straight-forward; not requiring any CSS or images files to be included,
- minimalist and consistent because it uses Base64-encoded
circle-close (cross)icons of jQuery UI.
You can see the plugin in action at JSFiddle.
Install jQuery InputSearch plugin via the command line with npm:
$ npm isntall jquery-inputsearch
Or simply by downloading it here.
Add the script to your page after adding jQuery:
A boolean value to determine whether the search icon should be visible or not.
An event callback handler when the clear icon is clicked.
Glenn Dwiyatcita (@dwiyatci)
WTFPL – Do What the Fuck You Want to Public License.