Plone 5.2/javascript - How do I register a single javascript resource?

I'm trying to register a javascript file called my_javascript.js.

I have a folder called 'resources' in my product directory where I place my_javascript.jd.

I have in configure.zcml

  <browser:resourceDirectory
      name="my.product"
      directory="./resources"
      />

In my javascript file:

(function ($) {

    $("#trythis").click(function(){
       	alert('hello');
    });

 });

In registry/main.xml, I have

<records prefix="plone.resources/my-product"
		 interface='Products.CMFPlone.interfaces.IResourceRegistry'>
  <value key="js">++resource++my.product/resources/my_javascript.js</value>
  <value key="url">++resource++my.product/resources</value>
</records>

In a template I have

<div id="trythis">Hello</div>

I also tried just doing alert('test'), nothing happened.

When I click on it, nothing happens and there are no error messages. I was looking through my browser's console and it looks like it not even being loaded. However, Plone seems to partially acknowledge its existence in Resource Registries under Site Setup and the js value is '++resource++my.product/resources/my_javascript.js'.

I was trying to follow documentation on this page:
https://docs.plone.org/adapt-and-extend/theming/resourceregistry.html

Where am I going wrong?

Edit: I meant $("#trythis")

I put 'that code' in:

/profiles/registry.xml

So:

<?xml version="1.0"?>
   <registry>
   … your code here
   </registry>

Then you need to reinstall the profile (uninstall and install the product, maybe)

Thank you for your response. I apologize for my late response.
So I made a new site and made and installed my.product with registry.xml under profiles default instead of registry/main.xml.
Unfortunately, I get the same result where it pseudo-acknowledges it exists, but it doesn't trigger.

I tried just doing:

(function ($) {

    alert('does this work?');

 });

and nothing happens. This test should have resulted in an alert popup whenever a page is loaded.

Also, just to note, bobtemplates was generating the profiles/default/registry/main.xml file structure.

Have you checked for javascript errors?
Any error 'could not find 'nameofjavascript.js' or similar ?


By the way: If you use jQuery, you might need to change the script, maybe

require([
  'jquery',
  ], function(Base) {
       $("#trythis").click(function(){
   	      alert('hello');
       });
    });
  });