From fbc7649f9936ab65d4c19e124eecdbb61158925c Mon Sep 17 00:00:00 2001 From: Loilo Date: Mon, 28 Apr 2014 05:11:49 +0200 Subject: [PATCH] removing and then adding same tag didn't work removing tags only removed the related DOM element. now also iterates over the "tags" array and removes entry there since this array is used to detect duplicates. don't forget to change minified version. :) --- tagging.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tagging.js b/tagging.js index e178860..062809b 100644 --- a/tagging.js +++ b/tagging.js @@ -227,6 +227,14 @@ .html( actual_settings[ "close-char" ] ) // click addEventListener .click(function() { + // remove tag from "tags" array + for ( i = 0; i < tags.length; i += 1 ) { + if ( tags[ i ][ 0 ] == $tag[ 0 ] ) { + tags[ i ].splice( i, 1 ); + break; + } + } + // remove the actual element $tag.remove(); }) // finally append close button to tag element