Hid Dencum Hid Dencum - 2 months ago 15x
Javascript Question

JQUERY Autocomplete (disable click selection)


I use a simply JQUERY Autocomplete to show possibles duplicates for certains records, like Name or address when user fill in a textfield.

Here code

<script type="text/javascript">
$(function() {
var availableTags = <?php include('ajax/ajax_show.php'); ?>;
source: availableTags,

Below text filed are displayes results.

Paul a
Robert b
Cid c

There is a way to disable selection?
I'm like to use autocomplete only to show records, but user cannot click to select anything.


You're probably going to confuse the user with this arrangement, since every other time he starts typing into a box and a list appears, the list will be a list of available options to select. You're changing the rules, and that doesn't make for the best UX. I would consider rethinking this.

That said, you can do what you want in the select option by calling preventDefault() in it:

    source: availableTags,
    select: function(e, ui) {