Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

This thread was closed and archived. Please ask a new question if you need help.

Javascript Developer - Unable to properly functioning "$" function

  • 2 replies
  • 1 has this problem
  • 3 views
  • Last reply by SuMo Bot

Hi Mozilla Community,

I am a Javascript Developer and I need a bit of help. This is my first time in a very long time contacting technical support. Please bare with me as I explain my situation. I recommend that someone that is familiar with Javascript and the browser console help test this issue.

I try to create a function in the browser console on a very blank html file. I created a function using the following code "const $ = $ => $". When I called the function with the following code "$('test')" I would get a return of "null". What is expected to return is "test". I have tested other browsers and it would seem to work perfectly fine. These browsers include: Edge, Chrome, Epiphany. I have also tried creating a function like so "const a = a => a". Then I called the function like this "a('test')". The result would be "test".

I had also asked a developer friend of mine to test this out and nothing is wrong on his end. I cannot recall what machine my friend runs but I know it does not run Linux. I wouldn't know well enough but my suspicions lie with the Linux version of Firefox. I have also tried uninstalling and reinstalling Firefox from my computer the results seem to remain the same.

I will attach images for a visual of the situation. I will also leave some specs that might be of concern down below.

Here are my computer specs:

LMDE 4 (debbie) x86_64 Kernel: 4.19.0-14-amd64 Shell: bash 5.0.3 Resolution: 2560x1080 DE: Cinnamon 4.8.6 CPU: AMD Ryzen 7 1700 (16) @ 3.000GHz GPU: NVIDIA GeForce GTX 1070 Memory: 6153MiB / 64414MiB

Firefox Version: 78.9.0esr (64bit)


Please get back to me, Terrance Banh

Hi Mozilla Community, I am a Javascript Developer and I need a bit of help. This is my first time in a very long time contacting technical support. Please bare with me as I explain my situation. I recommend that someone that is familiar with Javascript and the browser console help test this issue. I try to create a function in the browser console on a very blank html file. I created a function using the following code "const $ = $ => $". When I called the function with the following code "$('test')" I would get a return of "null". What is expected to return is "test". I have tested other browsers and it would seem to work perfectly fine. These browsers include: Edge, Chrome, Epiphany. I have also tried creating a function like so "const a = a => a". Then I called the function like this "a('test')". The result would be "test". I had also asked a developer friend of mine to test this out and nothing is wrong on his end. I cannot recall what machine my friend runs but I know it does not run Linux. I wouldn't know well enough but my suspicions lie with the Linux version of Firefox. I have also tried uninstalling and reinstalling Firefox from my computer the results seem to remain the same. I will attach images for a visual of the situation. I will also leave some specs that might be of concern down below. Here are my computer specs: LMDE 4 (debbie) x86_64 Kernel: 4.19.0-14-amd64 Shell: bash 5.0.3 Resolution: 2560x1080 DE: Cinnamon 4.8.6 CPU: AMD Ryzen 7 1700 (16) @ 3.000GHz GPU: NVIDIA GeForce GTX 1070 Memory: 6153MiB / 64414MiB Firefox Version: 78.9.0esr (64bit) Please get back to me, Terrance Banh

All Replies (3)

Hmm, I think I found the issue accidentally. I tried this (on Windows) on a basic page:

const $ = $ => $;
$('wtf?');
Uncaught DOMException: Document.querySelector: 'wtf?' is not a valid selector

The referenced line for the error is 321 which is part of a function built in to the DevTools -- a helper command:

https://developer.mozilla.org/docs/Tools/Web_Console/Helpers

So... it seems you may need to define $ in your page and not in the DevTools to work around the conflict.

The DevTools team has a forum where you might get other suggestions:

https://discourse.mozilla.org/c/devtools

Thanks jscher2000. I'll give it a try after my 2 nightshifts.

This question has been locked because the original author has deleted their account. While you can no longer post new replies, the existing content remains available for reference.