Join date: May 15, 2022

Instant Roof Pro [2022-Latest]




Category:3D modeling software Category:Building engineering software Category:Architecture modeling software Category:Building information modelingQ: jQuery remove() two elements at once I want to be able to remove two elements, at once. I'm using the 'before' parameter to the remove() function and putting two elements in there to be removed. However, it doesn't seem to work. Here is the markup: And the jQuery: $('.message').each(function(){ var $left = $(this).find('.message-left'); var $right = $(this).find('.message-right'); $left.fadeOut(5000, function(){ $left.remove(); }); $right.fadeOut(5000, function(){ $right.remove(); }); }); How do I achieve this, so that when the user clicks 'x' on message-left, message-right also fades out? A: Try changing the remove() method to.fadeOut(), it will fade out both items at the same time. A: If you want to remove two elements at the same time, this is probably what you want. $('.message').find('.message-left,.message-right').fadeOut(5000, function(){ $(this).remove(); }); If you want to remove two elements on a different event, I would suggest changing the event to be something other than click for your buttons. This would allow you to access the buttons themselves and do what you want, without interfering with their default behavior. Edit: I updated my example to have two event handlers instead of one to demonstrate the point. You'll see that when I click the buttons, I'm able to get access to the buttons and make them disappear. $('.message').find('.message-left,.message-right').fadeOut(5000, function(){ $(this).remove(); }); $('.