Tokenize2 check user permission before deleting tag

136 views Asked by At

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!

Tokenize2 Events

0

There are 0 answers