Some gatherings involve loud music and dancing such as weddings. Are we aloud to attend these gatherings and are we aloud to dance?

We should avoid gatherings in which haram things are being done.