Giter VIP home page Giter VIP logo

jquery-ui-autocomplete-with-clear-button's Introduction

jQuery UI Autocomplete with clear button

Extends jQuery UI Autocomplete widget with a button that clears away the current value of the autocomplete <input> element.

The following options are available:

  • clearButton - type: Boolean, default: true - adds a button that will clear the autocomplete input
  • clearButtonHtml- type: String, default: '&times;' - the content of the button
  • clearButtonPosition - type: Object|Boolean, default: {my: "right center", at: "right center"} - an object with the parameters needed to position the button using jQuery UI Position (http://api.jqueryui.com/position/). Set it to false if you want to position the button via CSS.

Demo

Demo available on Codepen.

Usage

Initialize the autocomplete the same as before.

$("input").autocomplete({
    // options 
});

Setup

Javascript

Include the script after jQuery UI's main javascript file:

<script src="jquery-ui.js"></script>
<script src="jquery-ui-autocomplete-with-clear-button.js"></script>

CSS / SASS

Include jquery-ui-autocomplete-with-clear-button.css in your project or use the .scss file:

<link rel="stylesheet" href="jquery-ui-autocomplete-with-clear-button.css" media="all" />
@import "jquery-ui-autocomplete-with-clear-button";

jquery-ui-autocomplete-with-clear-button's People

Contributors

andreivictor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

buyfie trieg

jquery-ui-autocomplete-with-clear-button's Issues

cross icon get wrong position when i have use multiple div show and hide

I am using radio button for show particular div show hide. each div have autocomplete with textbox.
at time current active div get proper position cross icon. but when i have flip div using js then
it div autocomplete cross icon not proper position. this issue happen because when div is hide but
we have value of text box. so it take position with in hide mode.

I have attached screenshot for better clarity of my issue.
Flights-Search-
Flights-Search- (1)

you can checked in screenshot when oneway div active on page refresh then it display proper. but when i change div roundtrip
at time cross button get wrong position.
I am using jquery ui 1.12 version.

two autocompletes on one page

Hi,
Love your solution !

I have two autocompletes on one form,
The "x" of the second one is not working since there's no unique ID generated for the span
It also creates two "x"-s for both the autocomplete fields

Can you offer a solution to this ?

Thanks,
Joop

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.