Topic: Autocomplete component not working

dru1000 pro asked 5 years ago


Hi, I can't get the new autocomplete component to work. I've copied the code into the default MDB Pro 4.3 download, I get a input box but nothing shows in the drop down as I type. The Javascript has populated the array as i've outputed this separately onto the page. Thanks
<div class="md-form">
        <input type="search" id="form-autocomplete" class="form-control mdb-autocomplete">
        <button class="mdb-autocomplete-clear">
            <svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg">
                <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
                <path d="M0 0h24v24H0z" fill="none" />
            </svg>
        </button>
        <label for="form-autocomplete" class="active">What is your favorite US state?</label>
    </div>
<script language="javascript">
var states = [
    "Alabana",
    "Alaska",
    "Arizona",
    "Arkansas",
    "California"
];

$('.mdb-autocomplete').mdb_autocomplete({
    data: states
});
</script>

Adrian Sawicki free answered 5 years ago


Hi Dru1000, 1. Do you have any information in the console about errors? 2. Did you place your autocomplete script at the bottom of your scripts? 3. The language attribute has been deprecated for a long time, and should not be used. Instead, you should use type. Regards

dru1000 pro answered 5 years ago


No need to reply to this it seems to be working as expected now, although i'm not sure what the problem was

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags