0
I have an auto complete system and I wanted the Aseemcem options goes down from the line where the user is typing, as for example code editors like the Dreamweaver.
Auto Complete - Jquery:
$(function() {
var availableTags = [
"<a></a>",
"<sub></sub>"
];
function split( val ) {
return val.split( /\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#tags" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).autocomplete( "instance" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
minLength: 0,
source: function( request, response ) {
// delegate back to autocomplete, but extract the last term
response( $.ui.autocomplete.filter(
availableTags, extractLast( request.term ) ) );
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( "" );
return false;
}
});
});
HTML:
<textarea id="tags" ></textarea>
that’s not what I wanted, I wanted these tags to look like in the line below which typed, in case he is typing in line 1, in line 2 would appear the tags for him to celerize.
– Daniel
I don’t understand, can you put an image attached to your question?
– Emir Marques
ok, http://i.stack.Imgur.com/Rannh.jpg, like this I wanted to
– Daniel
The effect you want is the same one I posted. Search for example by java and press Enter the effect will be the same
– Emir Marques
Note that it is not simple autocomplete, it has the focus feature on the first item in the list
– Emir Marques
I’m sorry I’m late because I forgot this question :-/. Not what I wanted was just the position as an example, I have a textarea with the height of 1500px and wanted the auto complete appears below the line in which this typing as in the photo. I hope I made it clear, sorry for the delay
– Daniel
See EDIT 1 pf
– Emir Marques