From d6a87ee4726cac8144269205352981e504eb3627 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 2 Nov 2013 00:20:21 -0500 Subject: [PATCH 1/2] Added readOnly option. This will make the input box readonly, and remove the "tagCloseIcon" from being rendered --- tagmanager.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tagmanager.js b/tagmanager.js index 68c3cfd..ea05858 100644 --- a/tagmanager.js +++ b/tagmanager.js @@ -38,7 +38,8 @@ tagCloseIcon: 'x', tagClass: '', validator: null, - onlyTagList: false + onlyTagList: false, + readOnly: false }, publicMethods = { @@ -106,9 +107,14 @@ escaped = $("").text(tag).html(); html = ''; - html+= '' + escaped + ''; - html+= ''; - html+= opts.tagCloseIcon + ' '; + html += '' + escaped + ''; + + if (!opts.readOnly) { + html += ''; + html += opts.tagCloseIcon + ''; + } + + html+= ' '; $el = $(html); if (opts.tagsContainer !== null) { @@ -416,6 +422,13 @@ privateMethods.killEvent(e); }); + if (opts.readOnly) { + $self.attr('readonly', true); + opts.backspace = [];//clear out the ability to delete on backspace + } else { + $self.attr('readonly', false); + } + if (opts.prefilled !== null) { if (typeof (opts.prefilled) === "object") { privateMethods.prefill.call($self, opts.prefilled); From a11a1d57be2f0a13d854067cba162aa62015f3db Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 2 Nov 2013 21:56:25 -0500 Subject: [PATCH 2/2] Changed readOnly mode to hide text box --- tagmanager.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tagmanager.js b/tagmanager.js index ea05858..51dfbea 100644 --- a/tagmanager.js +++ b/tagmanager.js @@ -423,11 +423,8 @@ }); if (opts.readOnly) { - $self.attr('readonly', true); - opts.backspace = [];//clear out the ability to delete on backspace - } else { - $self.attr('readonly', false); - } + $self.attr('style', 'display: none'); + } if (opts.prefilled !== null) { if (typeof (opts.prefilled) === "object") {