테마 헤더에 추가한 JavaScript에서 $ is not defined 오류 발생

Use native javascript, not jQuery.

(But even then be aware Discourse is a SPA PWA so you may have race conditions occuring if you are relying on certain elements having been rendered - and the solution to that is to use Ember Components rendered in specific plugin outlets in combination with modifiers)