Tab completion TextExt

I was working with TextExt for the first time and wanted to do some tab completion for efficiency. I was surprised to find it wasn’t a default option (or if it is I couldn’t find it!) This is how I did it though.

$('#tags').on('keydown', function(e) { 
   var keyCode = e.keyCode || e.which; 

   if (keyCode == 9) { 
   // the prevent default allow you to stay in focus in the input and keep adding tags in
   e.preventDefault(); 
   $(this).val('');
   $('#tags').textext()[0].tags().addTags([$('.text-selected span').text()]);
   } 
});

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>