Issues with Dev Mode Errors When Switching Between Desktop and Mobile Views

Hi everyone,

I’m new to using Dev Mode in Wix Studio and have a question about coding for desktop and mobile views. When I’m coding in Dev Mode, I’ve noticed that when I switch between the desktop and mobile views in the editor, I sometimes see redline errors on the elements that are specific to the other view (e.g., desktop-only elements give errors when in mobile view, and vice versa).

Is this normal behavior? Should I handle this by adding specific code to check for element visibility or existence before applying any actions, or is there a better approach for writing code that works seamlessly across both views?

I’d love to hear how others manage this issue and any best practices you’d recommend for coding in Dev Mode while switching between desktop and mobile views.

Thanks in advance for your feedback!

Yes, if your code is trying to access elements that aren’t there, the code will throw an error

You don’t need ti check whether the elements exist, instead, check whether the visitor uses mobile or desktop view and execute the code accordingly

1 Like