1
I need to make the autocomplete track the textarea when it is augmented.
<form class="form-control form-inline">
<label for="tags" class="control-label" id="upBody">Component: </label>
<textarea id="tags" ng-model="components"
class="search ng-pristine ng-touched ui-widget"
placeholder="Insert a component" autocomplete="on">
</textarea>
<button ng-click="search(components)"
class="btn btn-primary">See objects
</button>
</form>
.autocomplete({
appendTo: "#upBody",
minLength: 0,
source: function( request, response ) {
response( $.ui.autocomplete.filter(
availableTags, extractLast( request.term ) ) );
},
focus: function() {
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
.ui-autocomplete {
position: relative;
overflow-y: auto;
overflow-x: hidden;
max-height: 150px;
}
Thanks for the tip, @dvd. But in my case, I need that when I stretch the textarea, the autocomplete accompanies. Type, type part of a word, the autocomplete appears. When you stretch the textarea, autocomplete should follow.
– Antonio Braz Finizola
This stretch that I speak is not when typing, but when maximizing the textarea, with the drag on the right, understand?
– Antonio Braz Finizola
Example: The guy types a word and waits for the automplete to appear, when it appears the guy maximizes the textarea with drag and the autocomplete should go together.
– Antonio Braz Finizola
@Antoniobrazfinizola Ah tah. Put the full code in the question so that it is possible to reproduce. I have to reproduce only as an example and I see that it is not the same as yours.
– Sam
But my code is the same as the one you put there. I took it from the same place, jquery-ui. The only thing that changes is the data in the array.
– Antonio Braz Finizola
Yes, @dvd. Thank you! Now I have another question involving the autocomplete. I just want to, for example, inform 3 of the autocomplete values. textfield will only keep this 3 values informed and will not allow typing more?
– Antonio Braz Finizola
@Wouldn’t it be better to ask another specific question? Then other colleagues can also try to answer.
– Sam
@Antoniobrazfinizola But if it’s too much work, I can see here for you.
– Sam
You can leave it, @dvd. I’ll ask another question. Vlws.
– Antonio Braz Finizola
Here’s the question, @dvd. Thanks in advance. https://answall.com/questions/273113/determinar-quantidade-de-itens-do-autocomplete-que-um-textfield-pode-permitir.
– Antonio Braz Finizola