Skip to content

Instantly share code, notes, and snippets.

@gugote
Last active December 27, 2015 11:58
Show Gist options
  • Save gugote/7321923 to your computer and use it in GitHub Desktop.
Save gugote/7321923 to your computer and use it in GitHub Desktop.
Tag Creator - after choosing an option from a select, this script will generate a tag below, with the close button.
// SELECT with TAGS
// create the tags
$('#theform select.tagger').change(function(){
$newtag = ($(this).val());
$('.tagsarea').append('<span class="tag"><span class="deltag">x</span>'+ $newtag + '</span>');
});
// remove generated tags on click
$(document).on('click', '.tagsarea span.deltag', function() {
$(this).parent().remove();
});
@gugote
Copy link
Author

gugote commented Nov 5, 2013

@todo: need to put this on a mustache template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment