From 02b65a9ef4c1de9e3e50c9030887431adb190582 Mon Sep 17 00:00:00 2001 From: vGichar Date: Tue, 14 Apr 2015 10:42:12 +0200 Subject: [PATCH] fixed duplicating id --- src/jquery.tagsinput.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jquery.tagsinput.js b/src/jquery.tagsinput.js index 4531238..e838147 100644 --- a/src/jquery.tagsinput.js +++ b/src/jquery.tagsinput.js @@ -192,13 +192,15 @@ inputPadding: 6*2 },options); + var uniqueIdCounter = 0; + this.each(function() { if (settings.hide) { $(this).hide(); } var id = $(this).attr('id'); if (!id || delimiter[$(this).attr('id')]) { - id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id'); + id = $(this).attr('id', 'tags' + new Date().getTime() + (uniqueIdCounter++)).attr('id'); } var data = jQuery.extend({