Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

adding placeholder text #46

Merged
merged 1 commit into from

3 participants

@benoberkfell

Hi,

I was implementing tag-it in a project and wanted to have a way to add placeholder text in the automatically created input element (e.g. "type some tags here").

I added an option for that so I could do it cleanly, thought I'd send it over in case you thought this patch might be useful.

Ben

@aehlke aehlke merged commit f974e4e into aehlke:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 17, 2011
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +5 −0 README.markdown
  2. +4 −0 js/tag-it.js
View
5 README.markdown
@@ -147,6 +147,11 @@ Optionally set a *tabindex* attribute on the `input` that gets created for tag-i
Defaults to *null*
+### placeholderText (String)
+Optionally set a *placeholder* attribute on the `input` that gets created for tag-it user input.
+
+Defaults to *null*
+
## Events
View
4 js/tag-it.js
@@ -34,6 +34,7 @@
tagSource : null,
removeConfirmation: false,
caseSensitive : true,
+ placeholderText : null,
// When enabled, quotes are not neccesary
// for inputting multi-word tags.
@@ -100,6 +101,9 @@
if (this.options.tabIndex) {
this._tagInput.attr('tabindex', this.options.tabIndex);
}
+ if (this.options.placeholderText) {
+ this._tagInput.attr('placeholder', this.options.placeholderText);
+ }
this.options.tagSource = this.options.tagSource || function(search, showChoices) {
var filter = search.term.toLowerCase();
Something went wrong with that request. Please try again.