Skip to content

jQuery plugin which provides Twitter-style autocompletion of usernames in textareas when typing @

License

Notifications You must be signed in to change notification settings

mrkipling/jQuery-at-username

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery at-username plugin
by Bradley Abrahams for Playfire
http://mrkipling.github.com/jQuery-at-username/

Autocomplete usernames when typing @

Usage: apply to a textarea:
  $('textarea').atUsername(settings);

See example.html for a working example.

Settings (optional):

  containerSelector (default='.at-username-container'):
    description: string containing a selector
      If specificied, the element referenced in this selector (which should be a
      parent element of the textarea this is applied to) will be searched for
      all elements with a class of settings.usernameSelector; the $.text() value
      of these elements will be added to the searchable list of usernames.

  usernameSelector (default='.username'):
    description: string containing a selector
      If settings.containerSelector is specified, this is the selector that will
      be used to find elements within that container which contain usernames.

  xhrUsernames (default=null):
    description: string (URL)
      If exists, this URL will be queried. It should return JSON in the
      following format:
        { usernames: [ 'username1', 'username2' ... ] }
      These usernames will be searchable by all textareas using the plugin on
      that page that also have the same url specified in xhrUsernames. Each URL
      will only ever be queried once (see xhrOnFocus to control whether this is
      done lazily on focus, or on binding to the textarea).

  xhrOnFocus (default=true):
    description: boolean
      If true (and xhrUsernames is set), the xhrUsernames URL will be loaded
      lazily when the textarea has focus set for the first time. If false, it
      will be loaded in straight away on bind.

  numResults (default=5):
    description: int
      The number of results to display in the autocomplete dropdown.

About

jQuery plugin which provides Twitter-style autocompletion of usernames in textareas when typing @

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published