You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 10, 2023. It is now read-only.
Store settings/options in element's data object so that we can change option for each element
So that we can change settings at anytime
Following example shows that we can change propertyToSearch and hintText at anytime we want
Example:
$(document).ready(function() {
$(element).tokenInput([{
"first_name": "Arthur",
"last_name": "Godfrey",
"email": "[email protected]",
"url": "https://si0.twimg.com/sticky/default_profile_images/
},
{
"first_name": "Adam",
"last_name": "Johnson",
"email": "[email protected]",
"url": "https://si0.twimg.com/sticky/default_profile_images/
}], {propertyToSearch: "first_name"}
);
});
Later we can do followings at anytime
$(element).tokenInput("setOptions", {propertyToSearch: 'first_name', hintText: "Type first name here to search"});
$(element).tokenInput("setOptions", {propertyToSearch: 'last_name', hintText: "Type last name here to search"});
$(element).tokenInput("setOptions", {propertyToSearch: 'email', hintText: "Type email here to search"});
$(element).tokenInput("setOptions", {propertyToSearch: 'url', hintText: "Type url here to search"});
Check *Change propertyToSearch anytime* demo in demo.html file
$("#demo-input-change-propertytosearch-anytime").tokenInput("setOptions",{propertyToSearch: $(this).val(),hintText: "Type "+$(this).val()+" here to search"});
0 commit comments