Last active
December 27, 2015 11:58
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@todo: need to put this on a mustache template.