ItSolutionStuff.com

Multi Select Autocomplete JQuery Example with Code

By Hardik Savani • November 5, 2023
jQuery

In this post, i show you how to use autocomplete with multiple select options by jquery. I think you will did autocomplete for single option using the jquery ui plugin. but in this post, you can learn multi selection autocomplete using jquery ui. In bellow preview you can see how will output of your multi select autocomplete because its like choosing js or something like plugin. But for layout, i just add my own css. this example i use jquery ui js file and one more multiselect js file that file through we can do multi select and one more thing you can also customization of autocomplete.multiselect.js file for example if you want to add custom attribute when select option. so, let's see preview and example.

Preview:

Example:

<html>

<head>

<title>Autocomplete multiselect jquery Example</title>

<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"/>

<link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/savanihd/multi-select-autocomplete/master/style.css"/>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

<script src="https://raw.githubusercontent.com/savanihd/multi-select-autocomplete/master/autocomplete.multiselect.js"></script>

</head>

<body>

<div class="main-div">

<h2>Autocomplete multiselect jquery Example</h2>

<input id="myAutocompleteMultiple" type="text" />

</div>

<script type="text/javascript">

$(function(){

var availableTags = [

"Laravel",

"Bootstrap",

"Server",

"JavaScript",

"JQuery",

"Perl",

"PHP",

"Python",

"Ruby",

"API",

"Scheme"

];

$('#myAutocompleteMultiple').autocomplete({

source: availableTags,

multiselect: true

});

});

</script>

</body>

</html>

Try this example and use in your projects...

IF you want to download this from git then you can download from here GitHub

Tags: jQuery
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Remove Special Characters from a String in JQuery?

Read Now →

JQuery Remove All Numbers from String Example

Read Now →

How to use Laravel Variable in JQuery?

Read Now →

Laravel JQuery UI Autocomplete Ajax Search Example

Read Now →

Laravel 9 Autocomplete Search using JQuery UI Example

Read Now →

How to Remove Last Element from Array in JQuery?

Read Now →

How to Check Atleast One Checkbox is Checked or Not in JQuery?

Read Now →

How to access PHP variables in JQuery?

Read Now →

How to Allow Only One Checkbox Checked at a Time in JQuery?

Read Now →

How to Check Undefined, Empty and Null in JQuery?

Read Now →

How to Convert Line Breaks to br in jQuery ?

Read Now →

How to Check Object is Empty or Not in JQuery?

Read Now →