Skip to content

Commit

Permalink
Extracted the js prototype from the README file.
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Mar 10, 2013
1 parent c86fb34 commit ec8d475
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 48 deletions.
49 changes: 1 addition & 48 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Tag-it is a simple and configurable tag editing widget with autocomplete support

![Screenshot](http://aehlke.github.com/tag-it/_static/screenshot.png)

Check the [examples.html](http://aehlke.github.com/tag-it/examples.html) for several demos.

Check the [examples.html](http://aehlke.github.com/tag-it/examples.html) for several demos and the [prototype.js](http://aehlke.github.com/tag-it/prototype.js) file for a JavaScipt prototype with all options and events.

## Usage

Expand Down Expand Up @@ -241,52 +240,6 @@ The function receives the click event and an objecting containing `tag` and `tag
Called when attempting to create a tag while the tag limit has already been reached. Receives a null event,
and an object with the property `duringInitialization`. This can only be called if **tagLimit** is set.

## Prototype

Here is a prototype with all the default options and events:

$("#myTags").tagit({

// Options
fieldName: "skills",
availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"],
autocomplete: {delay: 0, minLength: 2},
showAutocompleteOnFocus: false,
removeConfirmation: false,
caseSensitive: true,
allowDuplicates: false,
allowSpaces: false,
readOnly: false,
tagLimit: null,
singleField: false,
singleFieldDelimiter: ',',
singleFieldNode: null,
tabIndex: null,
placeholderText: null,

// Events
beforeTagAdded: function(event, ui) {
console.log(ui.tag);
},
afterTagAdded: function(event, ui) {
console.log(ui.tag);
},
beforeTagRemoved: function(event, ui) {
console.log(ui.tag);
},
onTagExists: function(event, ui) {
console.log(ui.tag);
},
onTagClicked: function(event, ui) {
console.log(ui.tag);
},
onTagLimitExceeded: function(event, ui) {
console.log(ui.tag);
}

});


## Methods

### assignedTags()
Expand Down
40 changes: 40 additions & 0 deletions prototype.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$("#myTags").tagit({

// Options
fieldName: "skills",
availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"],
autocomplete: {delay: 0, minLength: 2},
showAutocompleteOnFocus: false,
removeConfirmation: false,
caseSensitive: true,
allowDuplicates: false,
allowSpaces: false,
readOnly: false,
tagLimit: null,
singleField: false,
singleFieldDelimiter: ',',
singleFieldNode: null,
tabIndex: null,
placeholderText: null,

// Events
beforeTagAdded: function(event, ui) {
console.log(ui.tag);
},
afterTagAdded: function(event, ui) {
console.log(ui.tag);
},
beforeTagRemoved: function(event, ui) {
console.log(ui.tag);
},
onTagExists: function(event, ui) {
console.log(ui.tag);
},
onTagClicked: function(event, ui) {
console.log(ui.tag);
},
onTagLimitExceeded: function(event, ui) {
console.log(ui.tag);
}

});

0 comments on commit ec8d475

Please sign in to comment.