We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to save a key and value here?
Possible data structure:
var countries = [ ['Germany', 'de'], ['USA', 'us'], ['Spain', 'es'] ];
I want this:
<li class="taggle "> <span class="taggle_text">Germany</span> <button class="close" type="button">×</button> <input type="hidden" value="de" name="taggles[]"> </li>
The text was updated successfully, but these errors were encountered:
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.
Sorry, something went wrong.
No branches or pull requests
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: