On click SVG does not print

I don’t know if it’s intended, but if I create an SVG form, let’s say an circle, and put an on click that triggers an function, and said function contains an print() or console.log(), the mensage I wanted printed does not work

Hola :sparkles::cat::sparkles:
como va?
Y llamaste a la funcion como parametro en el console?
Capas en una de esas…
Te gustaria compartir el codigo para que lo pueda ver?
Por que justamente yo estaba tratar de hacer lo mismo en el espacio de juego


I don’t know how to paste the code here, but I declared an SVG form and an function.

I will call the form “circle” and the function “colorTransition()”.

The function doesn’t have parameters and does an transition filing “circle” with an random color than prints the hexadecimal code for the color.

circle.on(“click”, colorTransition);

Doing the above changes the color but does not print the hexadecimal.

But doing colorTransition(); works fine, but this way I can’t change on click;

I also tried

circle.on(“click”, colorTransition());

But it acts as if I only did colorTransition (), without the onclick

my Spanish isn’t good so I will write in English.

I also had problems trying to use an function as a parameter, one way I got it to work was creating an variable with the same name as the function, then using it somewhere else in the code, like just a line with it and nothing else, then you delete the declaration of the variable.

As long as it is used somewhere in the code the button for you to use it will be there, and because you deleted the variable declaration it will now be tied to the function that was declared with the same name.

@eduardo_kerber try posting a screen shot so I can help you :no_mouth: