When I add behavior='autocomplete' to my input field, width is changing and not scaling anymore with browser/screen resize.
Someone experienced with easyAutocomplete has the same problem?
Thank you very much.
This code without data-behavior IS RESPONSIVE
<form>
<input class="form-control" type="text" placeholder="search">
</form>
This code with data-behavior="autocomplete" is NOT RESPONSIVE
<form>
<input class="form-control" type="text" placeholder="search" data-behavior="autocomplete">
</form>
- jQuery autocomplete plugin
When I add behavior='autocomplete' to my input field, width is changing and not scaling anymore with browser/screen resize.
Someone experienced with easyAutocomplete has the same problem?
Thank you very much.
This code without data-behavior IS RESPONSIVE
<form>
<input class="form-control" type="text" placeholder="search">
</form>
This code with data-behavior="autocomplete" is NOT RESPONSIVE
<form>
<input class="form-control" type="text" placeholder="search" data-behavior="autocomplete">
</form>
http://easyautocomplete.com - jQuery autocomplete plugin
Share Improve this question edited Nov 9, 2017 at 5:14 Mr McDonald asked Nov 9, 2017 at 4:48 Mr McDonaldMr McDonald 4837 silver badges18 bronze badges 2- 1 Can you please put your code? that will help to understand more about the question. – dwij Commented Nov 9, 2017 at 4:58
- I add the code. This code without data-behavior IS RESPONSIVE <form> <input class="form-control" type="text" placeholder="search"> </form> This code with data-behavior="autocomplete" is NOT RESPONSIVE <form> <input class="form-control" type="text" placeholder="search" data-behavior="autocomplete"> </form> – Mr McDonald Commented Nov 9, 2017 at 5:15
2 Answers
Reset to default 13With your jQuery easyautocomplete plugin you just need to set option adjustWidth to false and then you don’t need to touch your CSS.
var options = {
...
adjustWidth: false,
...
};
$("#example").easyAutocomplete(options);
You can use easy-autocomplete like below, no need to put data-behavior. Also, you need to override CSS applied by the easy-autocomplete library.
var options = {
data: ["blue", "green", "pink", "red", "yellow"]
};
$("#example").easyAutocomplete(options);
.easy-autocomplete{
width:100% !important
}
.easy-autocomplete input{
width: 100%;
}
.form-wrapper{
width: 500px;
}
<link href="https://unpkg.com/[email protected]/dist/easy-autocomplete.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/jquery.easy-autocomplete.js"></script>
<form class="form-wrapper">
<input id="example" class="form-control" type="text" placeholder="search">
</form>