Topic: How to use autocomplete with form-inline and a submit button?
Rocks360 pro asked 6 years ago
Rocks360 pro answered 6 years ago
Marta Wierzbicka staff answered 6 years ago
.form-inline .md-form .form-control.mdb-autocomplete { width: 15rem; }
Rocks360 pro answered 6 years ago
<div class="row"> <div class="col-md-6 offset-md-3"> <div class="d-flex justify-content-center">div> /** search form **/ </div> </div> </div>
Marta Wierzbicka staff answered 6 years ago
<form class="form-inline"> <div class="md-form mr-3"> <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> <button type="submit" class="btn btn-primary btn-md mb-2"><i class="fa fa-search"></i></button> </form>
var states = [ "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illnois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" ]; $('#form-autocomplete').mdb_autocomplete({ data: states });Best, Marta
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.5.1
- Device: MacBook,
- Browser: Safari, Internet Explorer, Crome
- OS: MacOS, Microsoft
- Provided sample code: No
- Provided link: No