Hide element if empty or has white space inside (jQuery)

Hi all,

I need to hide some elements have area empty with some white space inside. I can execute this with jQuery as seen below.

		jQuery('.course p').filter(function() {

		  return $.trim($(this).text()) === ''

		}).remove();

I have a custom.js file imported but nothing seems to be happening?
Is there a better way to do this? If so, please give me some advice.

Thanks!

Why do these elements exist in the first place?

I have now fixed elsewhere