Simple call to functions from "onclick" in render notes #10094
-
|
Hi, How can I call it from a button or a link as simply as : ? Thanks. Of course, I assume here the structure of the files is correct: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
|
The short answer is that traditional Instead, the standard pattern in Trilium render notes is to bind event handlers from JavaScript using render.html: <a href="#" class="my-alert-link">Click Here</a>myscripts.js: const $link = api.$container.find('.my-alert-link');
$link.on('click', (e) => {
e.preventDefault();
alert('Hello World!');
});The key points:
If you really want the inline onclick approach, you'd need to explicitly attach the function to To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
I did it like this:
|
Beta Was this translation helpful? Give feedback.
-
|
@diyoyo , you should also look into Preact JSX, you can define handlers much more easily and make use of bundles. |
Beta Was this translation helpful? Give feedback.
@diyoyo , documented in https://docs.triliumnotes.org/user-guide/advanced-usage/custom-resource-providers.