Category Archives: jQuery

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()]);
   } 
});