Insignia.js Examples

      
insignia(input);
      
    
      
insignia(input, {
  delimiter: ','
});
      
    
      
insignia(input, {
  deletion: true
});
      
    
      
insignia(input);
      
    
      
insignia(input, {
  parse: function (value) {
    return value.toUpperCase();
  }
});
      
    
      
insignia(input, {
  validate: function (value, tags) {
    return true;
  }
});
      
    
      
insignia(input, {
  parse: function (value) {
    return value.toUpperCase();
  },
  validate: function (value, tags) {
    return true;
  }
});
      
    
      
insignia(input);
      
    
      
var tagInput = insignia(input);

// insignia.find(input) also returns tagInput

toggle.addEventListener('click', function () {
  if (tagInput.destroyed) {
    tagInput = insignia(input);
  } else {
    tagInput.destroy();
  }
});
      
    
(but we wouldn't endorse doing that in forms, as it'd break the default submit behavior!)
      
var tagInput = insignia(input);

input.addEventListener('keypress', function (e) {
  if (e.keyCode === 13) {
    tagInput.convert();
    e.preventDefault(); // prevent form submission
  }
});