I just created a new website and cut & pasted some elements and code from one of my other sites. The JS code on my new site does not execute. ??? Code below. The #dropdown444 selector doesn’t even exist and no error is thrown. Did I forget to turn something on? Did I take a stupid pill??
Thx JD. Yes, I realize the dropdown444 can’t be referred, but that is my point. I intentionally created a syntax error and the editor didn’t throw an “invalid selector” message. It’s like the editor/interpreter is not running/executing.
That’s why I ask, did I take a stupid pill somewhere? Is there some qualifier that turns the editor/interpreter on & off?
Answer: Yes, I did take a stupid pill. Turns out the JS Editor does not attempt to reconcile any code (within an event, e.g. on_click) if the event is not referenced (called) from the web page. Once I referenced my button to the on-click event handler, all is well.
It’s a very frequent issue. This is one of reasons why I prefer to use $w(“#button”).onClick(e => {/code/}) and not the export function button_click .
This way you can see every thing.