Permalink
Browse files

Merge pull request #145 from COil/master

[doc] Added a prototype with options and events
  • Loading branch information...
2 parents f09cfd6 + ec8d475 commit d7ecf4817e1a4be4e70d05246c67d12f05561226 @aehlke committed Apr 5, 2013
Showing with 41 additions and 3 deletions.
  1. +1 −3 README.markdown
  2. +40 −0 prototype.js
View
@@ -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
@@ -274,7 +273,6 @@ Clears the widget of all tags — removes each tag it contains, so the **beforeT
$("#myTags").tagit("removeAll");
-
## Properties
### tagInput
View
@@ -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 d7ecf48

Please sign in to comment.