I'm using Tokenize2 library and need to check if user has permission to delete specific tag or not. Below is my code for this:
$('.tokenize').tokenize2({
dataSource: tagsurl,
placeholder: 'Add tags for images images.',
searchMinLength: 3
});
$('.tokenize').on("tokenize:tokens:remove", function(e, value) {
var checkPermission = checkpermission(userpermissiontagurl, value);
if (checkPermission) {
tokensetup(removetagurl, value);
}
return 0;
});
The issue is it still hide that tag. How can I make it stop to not hide tag if user can't delete it. Thanks!