Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - How to check if autocomplete is bound

Sometimes I need to know if an input field already has autocomplete bound to it. I haven't found any other way to do this other than:

$input.hasClass('ui-autocomplete-input')

Then I discovered that elements with autocomplete has an attribute like this:

<input autocomplete="off">

This however never seems to be set to on, and I can't find any documentation about this attribute.

Question: What is the best/correct way to check if autocomplete has been bound to an element?

like image 827
Fractalf Avatar asked Dec 03 '13 11:12

Fractalf


1 Answers

you can also use the data property

var check = $input.data('ui-autocomplete') != undefined;
like image 71
Arun P Johny Avatar answered Oct 24 '22 20:10

Arun P Johny