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")