bassjobsen / Bootstrap-3-Typeahead

The Typeahead plugin from Twitter's Bootstrap 2 ready to use with Bootstrap 3 and Bootstrap 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minLength not working with data attributes

yahyaerturan opened this issue · comments

I can't make it run with data attributes.

<input type="text" name="nameserver1" id="nameserver1" placeholder="ns1" class="form-control force-selection" autocomplete="off"
                data-provide="typeahead"
                data-items="10"
                data-minLength="3" 
                data-source='["ns1.vayeshost.com","ns25.turkishost.com","ns1.natrohost.com"]'

Thanks for posting your issue. You are right, the above don't work indeed.
I found this problem is related to jQuery's data() function, see also: http://bugs.jquery.com/ticket/9066 and http://stackoverflow.com/questions/7641551/have-jquery-ignore-case-in-attribute-data-names.

A Quick solution seems to use data-min-length which will be convert by jQuery's data() into minLength. I will consider to make all name lowercased to prevent this, but maybe there will be a good reason for this jQuery strategy?