loopj/jquery-tokeninput — Issue #263: optional focus when calling to selector.tokenInput("clear")
Author: edwardCC
Created: 2012-01-28 02:48:32+00:00
State: open

this is a simple but useful ( and needed ) fix

when call to

selector.tokenInput("clear");

all the current tokens are deleted and automatically do focus on the input element, this can be inappropriate when multiple clearing are done, consider the following code ::

$("#country").tokenInput("clear");
$("#state").tokenInput("clear");
$("#city").tokenInput("clear");

if i want keep the focus on the "country" field i can't cuz is automatically set, the "patch" for this would be

$("#country").tokenInput("clear");
$("#state").tokenInput("clear");
$("#city").tokenInput("clear");

$("#country").focus();

but it will be nice

$("#country").tokenInput("clear",{focus:true});
$("#state").tokenInput("clear",{focus:false});
$("#city").tokenInput("clear",{focus:false});