The methods mentioned above rely on how the listener is set up: jQuery, element property.
If you prefer a reliable method that works regardless of the event setup, consider using How can I trigger a JavaScript event click
elements[0].onmousedown = function(){
fireEvent(elements[0], 'onmouseup');
};
Keep in mind that it may be more beneficial to encapsulate the mouseup handler's behavior into a function that can be easily called. Triggering handlers can be problematic as you might inadvertently trigger other events. For instance:
function doSomethingOnMouseUp() {
console.log('something on mouse up');
}
elements[0].onmousedown = function(){
doSomething();
doSomethingOnMouseUp();
};
elements[0].onmouseup = doSomethingOnMouseUp;