Buy Now
Sign in

How to run custom JavaScript function during onchange event

razlie , November 20 2017
Answered
R
razlie
Hi I want to run a custom function during onchange event in my input text field..
My question is how do i specify / set the function to run in the onchange event ..

Appreciate your help
Attachments
chrono.png
chrono.png
(17.31 KiB)
242 Downloads/Views
admin
Hi Razlie,
Just add the function name in the "Element identifier" box and define teh function in a JavaScript element
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
J
Joao Serina
Hi Max,
I must be doing something wrong because I have tried to do this and it didn't work. I tried the function name with and without brackets "()" and neither worked.
My JS code is in a custom JS code in the designer tab but I have also tried it with the script on a custom code action in the setup tab.
Thank you for your time.
Best regards,
Joao Serina
admin
Hi Joao,
The function name should be in the "Element identifier" box without brackets and the function should be defined in a JavaScript element:
function xyz(){​
​alert(123);​
​}
This does not work ?
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
J
Joao Serina
Sorry for the late reply,
I didn't test it yet but I was calling a function that was encapsulated in a jQuery call like:
(function($)​
​{​
​ $(document).ready(function () {​
​ ​
​ });​
​​
​ function MyFunction() ​
​ {​
​ alert("test");​
​ }​
​​
​})(jQuery);
So this was probably the problem.
Thank you very much for you quick reply and once again I appologuise for the delayed reply.
admin
Hi Joao,
No problems!
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!