Remove function doesn’t work jQuery

70 viewsjquerysapui5jquery sapui5
0

I’m trying to use this jQuery function:

$('a').filter(function(index) { 
    return $(this).text() === oEvent.getSource().getTarget().split("/")[0]; 
}).nextAll().remove();

This function is called when I press a link in a toolbar and I want to remove all next link in the toolbar but it doesn’t work. When I press the link it seems to work because all next link are removed but instantly they reappear. I’m using SAP UI5 and I hate it. Someone has a solution or any other ideas?