What is the right way to call function sinde events tab?

fl flashfs 06 Apr, 2018
I'm trying to do a simple test.
On a javascript element, I create the code
function testFunc() {
alert('test');
}
On a dropdown I go the the Events tab, then I select Function within the Actions options, then I write [testFunc]. This is not working. I also tried [testFunc()] without success. Many months ago, I've created a topic explaining a bug. Is this still happening?
​
I think the problem is around here
event_targets = jQuery.merge(event_targets, jQuery(ident));
jQuery("[testFunc()]") returns an error and jQuery("[testFunc]") returns nothing (I can see that because event_targets remains empty).
Gr GreyHead 08 Apr, 2018
Hi flashfs,
​
Have you tried just testFunc with no brackets?
​
Bob
fl flashfs 08 Apr, 2018
Yes, and you can refer to the old topic. If I doesn't use brackets, it will try to select a input, like input[name=testFunc], what is wrong.
Gr GreyHead 08 Apr, 2018
HI flashfs,
​
It seems to work OK when I test
​
BobWhat is the right way to call function sinde events tab? image 1
fl flashfs 09 Apr, 2018
I'm sorry, you are absolutely right. I have a small different function and thought that the problem was with the component. A simple function like that indeed works.
​
But now I ask: how can I pass variables in the Events tab?
​
testFunc being that:
function testFunc(variable) {
alert(variable);
}
I tried calling testFunc('hey') but I get Error: Syntax error, unrecognized expression: testFunc('hey')
This topic is locked and no more replies can be posted.