Skip to content
Advertisement

Unable to hide and show fields with select

I am trying to show and hide fields with respective selected value from tag. But it is not working. This same code is working perfectly in my other site. But it is not working here, don’t know which thing i am missing. Here is the code

JavaScript

Advertisement

Answer

Your script needs to be told to wait for the window to be loaded first. You can use jQuery to do this by simply adding $(() => { ... }) around your existing script:

JavaScript

Natively, you would use window.onload = () => { ... }; instead.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement