-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key and value in tag? #123
Comments
You can do something like this: var countries = [
['Germany', 'de'],
['USA', 'us'],
['Spain', 'es']
];
var map = countries.reduce(function(acc, pair) {
var code = pair[1];
var country = pair[0];
acc[code] = country;
return acc;
}, {});
var example = new Taggle('example1', {
tags: Object.keys(map),
tagFormatter: function(li) {
var text = li.querySelector('.taggle_text');
var displayText = map[text.textContent];
text.textContent = displayText;
return li;
}
}); Demo here. I do like the idea of being able to edit the input value a bit easier though so I'll leave this issue open. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to save a key and value here?
Possible data structure:
I want this:
The text was updated successfully, but these errors were encountered: