Hi everyone, i have problems with javascript, when making custom drop down menu. I have following function with onclick on container and in the browser console says, "type error: a is null". Togglemenu() function is not working. How can i fix. Thank you very much.

Hi,

Does document.getElementById("Smenu") return any results if you run it in your browser console?

Using typeof in that if doesn't strike me as correct either, since it's going to almost certainly return "string" instead of "block".

Do you think you could isolate your dropdown menu into a module so we could take a look?

Hi,

Try to pass the ID to the variable as "NameOfTheElement.Id" and pass this value to the function on the onclick action instead of the screen's javascript.

Something like: onclick = "togglemenu(" + Name.Id + ");"

Hi, Phone.

Use javascript action instead of screen's javascript like mentioned above.

Try this and share the result with us.

Maybe the widget 'Smenu' still dont' was create when you try to pass the value..

Leonardo Nascimento wrote:

Hi, Phone.

Use javascript action instead of screen's javascript like mentioned above.

Try this and share the result with us.

Maybe the widget 'Smenu' still dont' was create when you try to pass the value..

Hi Leonardo Nascimento, sorry for my late reply. As your answer, I use Javascript action to solve my problem and it does work. And i think it is a lot more easier than using screen's javascript. Thank you for your answer.