From 32f2f35cfc5fbcf5ab382e4e3eca1952b0705859 Mon Sep 17 00:00:00 2001 From: Georg Schmidl Date: Fri, 8 Jul 2011 14:25:24 +0200 Subject: [PATCH] Don't add tokens if limit has been reached. --- src/jquery.tokeninput.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jquery.tokeninput.js b/src/jquery.tokeninput.js index 4d01f392..a767d842 100644 --- a/src/jquery.tokeninput.js +++ b/src/jquery.tokeninput.js @@ -470,8 +470,10 @@ $.TokenList = function (input, url_or_data, settings) { } // Insert the new tokens - insert_token(item); - checkTokenLimit(); + if(settings.tokenLimit == null || token_count < settings.tokenLimit) { + insert_token(item); + checkTokenLimit(); + } // Clear input box input_box.val("");